ไอทีอื่น ๆข่าว#เทคโนโลยี

3 คำสั่ง DISM ที่ควรรู้เพื่อแก้ปัญหาภาพระบบ Windows

ตรวจสอบและซ่อมแซมไฟล์ระบบที่เสียหายด้วยคำสั่ง DISM เหล่านี้ ShotxArbaz/Shutterstock Your Windows installation depends on a collection of important system files to run applications, install updates…

3 คำสั่ง DISM ที่ควรรู้เพื่อแก้ปัญหาภาพระบบ Windows

ตรวจสอบและซ่อมแซมไฟล์ระบบที่เสียหายด้วยคำสั่ง DISM เหล่านี้

A person typing on a laptop keyboard.

ShotxArbaz/Shutterstock

Your Windows installation depends on a collection of important system files to run applications, install updates and perform everyday computing tasks. If these files get damaged or go missing, your system may behave erratically. You may encounter system errors, features not working as expected, freezes or other unexpected behavior. Sometimes restarting your computer or running the usual troubleshooting steps aren't enough to restore damaged system files. For such cases, Windows provides a built-in repair utility called Deployment Image Servicing and Management (DISM).

DISM เป็นเครื่องมือจากบรรทัดคำสั่งที่สามารถสแกนภาพระบบของ Windows เพื่อตรวจสอบไฟล์ระบบที่เสียหายและพยายามซ่อมแซมได้ โดยเฉพาะมีคำสั่ง DISM สามคำสั่งที่มีประโยชน์ ได้แก่ CheckHealth, ScanHealth และ RestoreHealth คุณสามารถรันคำสั่ง DISM ผ่าน Command Prompt หรือ PowerShell ได้ แต่ทั้งสองเครื่องมือจำเป็นต้องมีสิทธิ์ผู้ดูแลระบบในการเปลี่ยนแปลงระดับระบบ นอกจากนี้ควรทราบว่า DISM จะสแกนและซ่อมแซมเฉพาะไฟล์ระบบเท่านั้น ขณะที่ไฟล์ส่วนตัวของผู้ใช้จะไม่ได้รับผลกระทบแต่อย่างใด

สามคำสั่ง DISM ที่ช่วยแก้ปัญหาการติดตั้ง Windows ที่เสียหาย

คำสั่ง DISM ทั้งสามที่กล่าวถึงมีรูปแบบเฉพาะเริ่มต้นด้วย DISM /Online /Cleanup-Image โดยส่วนที่ตามหลังคำว่า DISM ในรูปแบบนี้เรียกว่าตัวเลือกบรรทัดคำสั่ง (command-line options) ซึ่งตัวเลือก /Online ระบุให้ DISM ดำเนินการกับการติดตั้ง Windows ที่กำลังทำงานอยู่ ในขณะที่ตัวเลือก /Cleanup-Image จะดำเนินการซ่อมแซมระบบในการติดตั้งที่เลือกไว้

คำสั่งแรกคือ DISM /Online /Cleanup-Image /CheckHealth ซึ่งใช้ตรวจสอบว่า Windows ได้ระบุไฟล์ระบบเสียหายไว้หรือไม่ และความเสียหายดังกล่าวสามารถซ่อมแซมได้หรือไม่ โดยเป็นขั้นตอนแนะนำอันดับแรกเมื่อตรวจสอบปัญหาไฟล์ระบบเสียหาย เนื่องจากใช้เวลาน้อยในการดำเนินการ

คำสั่งถัดไปคือ DISM /Online /Cleanup-Image /ScanHealth ซึ่งทำงานต่างจากคำสั่ง CheckHealth โดยสิ้นเชิง โดยต่างจาก CheckHealth ที่ตรวจสอบสถานะเดิม คำสั่ง ScanHealth จะสแกนไฟล์ระบบใหม่ทั้งหมดและรายงานผลการตรวจพบทั้งหมด ในขณะที่กระบวนการ ScanHealth อาจใช้เวลาหลายนาทีในการดำเนินการ แต่จะให้รายงานสถานะสุขภาพของส่วนประกอบในระบบ (component store) ที่ทันสมัยและแม่นยำยิ่งขึ้น

Finally, the DISM /Online /Cleanup-Image /RestoreHealth command both scans the component store for corruption and attempts to repair them automatically. By default, RestoreHealth uses Windows Update to obtain the necessary system files needed to repair the component store. The Windows component store is a protected internal repository that contains important system files. Windows requires these files to service, update and customize the operating system.

จะทำอย่างไรหาก DISM ไม่สามารถซ่อมแซมการติดตั้ง Windows ของคุณได้?

Sometimes system file damage can also break Windows Update, preventing DISM from downloading replacement files. When this happens, you can use an official Windows installation media to supply DISM with the necessary repair files. You can download a Windows ISO from Microsoft's official download page. Once downloaded, right click the ISO file and select mount. Windows will create a virtual drive for the ISO, assign it a drive letter and make its contents available.

Next, you'll need to check the Windows editions available in the downloaded installation media. You can do that by launching the command prompt as an administrator and running the DISM /Get-ImageInfo /ImageFile:D:sourcesinstall.wim command. This command lists the Windows editions available on the installation media along with their index numbers. Make a note of the index number corresponding to your installed edition before proceeding to the next step.

จากนั้นรันคำสั่ง DISM /Online /Cleanup-Image /RestoreHealth /Source:WIM:D:sourcesinstall.wim:6 /LimitAccess โดยแทนที่ D: ด้วยตัวอักษรไดรฟ์ที่ระบุไว้สำหรับไฟล์ ISO ของ Windows ที่ติดตั้ง และแทนที่เลข 6 ด้วยหมายเลขดัชนีที่สอดคล้องกับเวอร์ชัน Windows ที่ใช้งานอยู่ คำสั่งนี้จะบังคับให้ DISM ใช้สื่อติดตั้งเป็นแหล่งซ่อมแซมแทนที่จะดาวน์โหลดไฟล์จาก Windows Update

หลังจากดำเนินการเสร็จสิ้นด้วย DISM ให้รันคำสั่ง sfc /scannow เพื่อซ่อมแซมไฟล์ระบบที่เสียหายหรือหายไป โดยไมโครซอฟท์แนะนำให้ใช้เครื่องมือซ่อมแซม DISM ก่อน System File Checker (SFC) เนื่องจาก DISM จะซ่อมแซมส่วนเก็บองค์ประกอบของ Windows ซึ่ง SFC พึ่งพาในการแทนที่ไฟล์ระบบที่เสียหาย