0

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?

2
  • 4
    Did you start Powershell with or without Administrative rights? Do you have access to F:\ from command Line? Due to UAC and elevation of rights you might not have access to the mounted share on "F:\" (if it is a mounted share at all.) Did you try it with UNC?
    – frupfrup
    Nov 17, 2015 at 15:46
  • When I do it with Administrative rights, takeown will set the user to "Server\Administrator" and I do not have access to that user. Nov 18, 2015 at 15:55

0

You must log in to answer this question.

Browse other questions tagged .