Share via


Remove-Item ends up with access denied.

Question

Tuesday, March 1, 2011 12:36 PM

Hi,

My problem is as follows:

OS: Windows 7 Enterprise

I'm logged in as the local administrator.

When I run the powershell with admin privileges and try to delete a folder inside C:\Users\ I get "Access Denied"

 

rm -
Force -
Recurse install

 

The user "install" is already deleted. With the explorer, I can simply delete this folder.

When I use Get-ChildItem on the Program Files folder for example I also get many "Access Denied" messages.

It seems the powershell, even when started with "run as Administrator", doesn't run with full admin privileges.

Is there something I can do or do I have to use the "old" command chell (cmd.exe)with batch files?

 

All replies (2)

Tuesday, March 1, 2011 12:43 PM âś…Answered

Change the owner and remove the object.Try to use first  TAKEOWN /F directory /R /A  and rm.

1) http://www.sysadmins.lv/content/scripts/Set-Owner.ps1

2) SetAcl - http://helgeklein.com/download/

3) takeown - vista or higher


Thursday, March 3, 2011 7:19 AM

Hi,

 

 

Please check whether you have permission to delete the target folder.

 

 

Thanks.