当我在 Powershell ISE 中运行此脚本时:
[System.Threading.Thread]::CurrentThread.CurrentCulture = 'en-us'
$folder = Read-Host 'Dove sono le cartelle degli utenti?'
$name = Read-Host 'Specificare la cartella dell utente?'
takeown /f $folder\$name /r /d Y
icacls $folder\$name /t /c /grant T135837TS:F /q
icacls $folder\$name /grant ([String]($name.replace(".V2",""))):F /t /c /q
我收到此错误:
icacls : Invalid parameter "npac001"
At line:1 char:1
+ icacls $folder\$name /grant ([String]($name.replace(".V2",""))):F /t /c /q
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Invalid parameter "npac001":String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
其中 npac001 是必须具有权限的用户。