2

When navigating to C:\Users\%SomeUsername% as an administrator on a Windows 2008 R2 server I get the error You don't currently have permission to access this folder, Click Continue to permanently get access to this folder. Clicking Continue resolves this problem.

If I try the same by PowerShell (e.g. get-childitem 'C:\Users\' -Directory | get-childitem -Force; or some variant), any profiles to which I've not already granted myself access explicitly give the error Access to the path 'C:\Users\%SomeUsername%' is denied.; even with the Force switch included.

Is there a way to "click continue" via PowerShell; i.e. have the system give me access to anything which I don't strictly have access to, though as an administrator on the server can grant myself access to. Ideally this would be done as I access the files (e.g. by a switch on the Get-Item command) rather than having to code something to explicitly go through all files checking and amending permissions.

JohnLBevan
  • 22,735
  • 13
  • 96
  • 178

2 Answers2

4

Make sure about start Powershell Run As Admin if you want always run it as administrator make shortcut from powershell.exe and follow this image : enter image description here

saftargholi
  • 896
  • 1
  • 9
  • 25
0

My mistake; I hadn't been running the PowerShell session as administrator (i.e. UAC).

  • right click on powershell.exe
  • run as administrator
JohnLBevan
  • 22,735
  • 13
  • 96
  • 178