본문 바로가기

Windows 10/PowerShell

PowerShell : TrustedInstaller 권한 때문에 삭제 불가능한 파일 삭제하기

반응형

윈도우의 시스템 파일 보호를 위해 TrustedInstaller 권한을 부여받아야만 삭제가 가능한 파일들이 있다.

예를 들어 C:\Windows\SysWOW64\OneDriveSetup.exe 파일의 경우 삭제가 불가능하다.

 

이 경우 아래 명령어를 통해서 파일의 소유와 권한을 변경하여 삭제 할 수 있다.

 

TakeOwn /f 파일

ICacls 파일 /grant Administrators:f

rm 파일

 

TakeOwn /f "C:\Windows\SysWOW64\OneDriveSetup.exe"

ICacls "C:\Windows\SysWOW64\OneDriveSetup.exe" /grant Administrators:f

RM "C:\Windows\SysWOW64\OneDriveSetup.exe"

 

반응형

'Windows 10 > PowerShell' 카테고리의 다른 글

PowerShell : Registry  (0) 2019.08.21
PowerShell : Get-ChildItem (ls), 응용  (0) 2019.07.14
PowerShell : Get-Content, Set-Content, Out-File (파일 입출력)  (0) 2019.07.09
PowerShell : 기본 명령어  (0) 2019.06.16
PowerShell : Alias  (0) 2019.06.15