Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การแก้ไขปัญหา >> ข้อผิดพลาด Windows

วิธิลบไฟล์ที่ถูกปกป้องโดย TrustedInstaller ใน Windows 10 อย่างปลอดภัย

TrustedInstaller เป็นบัญชีผู้ใช้ของบริการ Windows Modules Installer ที่เป็นเจ้าของไฟล์และโฟลเดอร์ระบบสำคัญ แม้คุณจะเป็น Administrator ก็ไม่สามารถแก้ไข ลบ หรือเปลี่ยนชื่อไฟล์เหล่านี้ได้โดยตรง จะแสดงข้อความ "You need permission from TrustedInstaller"

ควรลบ TrustedInstaller ออกจากสิทธิ์หรือไม่?

ไม่แนะนำ TrustedInstaller มีไว้ปกป้องไฟล์ระบบจากไวรัส/มัลแวร์และการเปลี่ยนแปลงโดยไม่ได้ตั้งใจ หากลองลบออกจะเจอข้อความว่าไม่สามารถลบได้เพราะสืบสิทธิ์จาก parent object

วิธีที่ถูกต้องคือ ยึดความเป็นเจ้าของ (Take Ownership) ไฟล์/โฟลเดอร์มาเป็นของตัวเอง แล้วจึงให้สิทธิ์ Full Control

3 วิธีลบไฟล์ที่ถูกปกป้องโดย TrustedInstaller

วิธีที่ 1: ยึดความเป็นเจ้าของด้วยตนเอง (Manual)

  1. คลิกขวาไฟล์/โฟลเดอร์ > Properties > แท็บ Security > Advanced
  2. ที่ Owner (แสดง TrustedInstaller) กด Change
  3. กด Advanced > Find Now
  4. เลือกบัญชีผู้ใช้ของคุณจากรายการ > OK > OK
  5. ติ๊ก Replace owner on subcontainers and objects (หากเป็นโฟลเดอร์) > Apply > OK
  6. กลับไปที่ Advanced Security Settings อีกครั้ง > Add > Select a principal
  7. Advanced > Find Now > เลือกบัญชีเดียวกัน > OK
  8. ติ๊ก Full control (Basic permissions ทั้งหมด) > ติ๊ก "Only apply these permissions to objects and/or containers within this container" > OK
  9. กด Yes บนข้อความเตือน > Apply > OK ทุกหน้าต่าง
  10. ตอนนี้สามารถลบ/แก้ไขไฟล์ได้แล้ว

วิธีที่ 2: เพิ่มเมนู "Take Ownership" ใน Context Menu ผ่าน Registry

  1. เปิด Notepad คัดลอกโค้ด Registry ด้านล่างไปวาง:
    Windows Registry Editor Version 5.00
    [-HKEY_CLASSES_ROOT\*\shell\runas]
    [HKEY_CLASSES_ROOT\*\shell\runas]
    @="Take Ownership"
    "HasLUAShield"=""
    "NoWorkingDirectory"=""
    "Position"="middle"
    [HKEY_CLASSES_ROOT\*\shell\runas\command]
    @="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F /c /l & pause"
    "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F /c /l & pause"
    ... (โค้ดเต็มสำหรับ Directory, dllfile, Drive, exefile - ดูในบทความต้นฉบับ) ...
  2. Save As > ประเภท All Files ชื่อ takeownership.reg (ต้องลงท้าย .reg)
  3. คลิกขวาไฟล์ .reg > Install > Yes
  4. ตอนนี้คลิกขวาไฟล์/โฟลเดอร์ใดๆ จะมีเมนู Take Ownership ให้เลือกใช้ได้ทันที
  5. ถ้าต้องการลบเมนูนี้ออก ให้สร้างไฟล์ uninstallownership.reg ด้วยโค้ดลบ Registry แล้วรัน

วิธีที่ 3: ใช้โปรแกรมภายนอก (Take Ownership App)

ดาวน์โหลดและติดตั้งโปรแกรม Take Ownership (ฟรี) จะเพิ่มเมนู "Take Ownership" ให้อัตโนมัติ ใช้งานง่ายกว่าวิธี Registry แต่อาจต้องระวังแหล่งที่มาของโปรแกรม

ข้อแนะนำ: หลังยึดสิทธิ์แล้ว ควรกลับไปตั้งค่าสิทธิ์ให้กลับมาสมดุลหรือสร้าง Restore Point ก่อนทำการลบไฟล์ระบบ