Reputation: 23
I am currently attempting to delete the C:\Program Files\SomeApp folder on a test PC where I do not know the administrator password. I have access to cmd.exe, powershell, and not much else.
When I try running rm "C:\Program Files\TestApp\*"
I get this:
Confirm
The item at C:\Program Files\TestApp has children and the Recurse parameter was not specified. If you continue, all children will be removed with the item. Are you
sure you want to continue?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
When I say y
+ [ENTER]
it says this:
At line:1 char:1
+ rm "C:\Program Files\TestApp\*"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (SomeFile.txt:FileInfo) [Remove-Item], UnauthorizedAccessException
+ FullyQualifiedErrorId : RemoveFileSystemItemUnAuthorizedAccess,Microsoft.PowerShell.Commands.RemoveItemCommand
rm : Cannot remove item C:\Program Files\TestApp\SomeFile.txt: Access to the path 'SomeFile.txt' is denied.
Which was expected, but I was hoping otherwise.
Anyway, Thanks in advance!
Upvotes: 0
Views: 1468
Reputation: 41057
With User Account Control enabled (the default and recommended setting), administrator rights are required to modify the C:\Program Files
folder.
https://learn.microsoft.com/en-us/windows/win32/dxtecharts/user-account-control-for-game-developers
https://learn.microsoft.com/en-us/previous-versions/dotnet/articles/bb530410(v=msdn.10)
Upvotes: 2