
実行してユーザーのホームフォルダへの権限を変更しようとしています
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"