我正在尝试通过运行来更改用户主文件夹的权限
icacls $folder /grant corp.commonwealth.com\"$folder":(OI)(CI)F /t
其中 $folder 是此人的用户名。
我一直收到错误
OI : The term 'OI' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
在仍具有 :(OI)(CI)F 选项的同时包含 $folder 变量的最佳方法是什么?
谢谢!
答案1
通过执行以下操作可以解决此问题:
$username = get-content T:\userlist.txt
$icacls = "C:\Windows\system32\icacls.exe"
&$icacls $username /grant domain\"$username"":(OI)(CI)F /t"