I created a BAT file that executes this
C:\Windows\system32\icacls.exe "F:\Users\username" /inheritance:r /T /C /Q
It works fine.
When I copy the command within a PowerShell, I get error messages
C:\Windows\system32\icacls.exe : F:\Users\username\*: Access is denied.
At line:1 char:1
+ C:\Windows\system32\icacls.exe "F:\Users\username" /inheritance:r /T /C /Q
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (F:\Users\username....cess is denied.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Is there a better way to do this within PowerShell?
0 Answers