我正在嘗試透過運行來更改用戶主資料夾的權限
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"