0
我想遠程設置一些ACL。遠程修改ACL幾臺PC
文件test.csv
包含計算機和用戶名。我認爲這個問題是通過內部Enter-Pssession
場$user
:
Import-Csv C:\test.csv | ForEach-Object {
Enter-PSSession -ComputerName $Computer
$Path = C:\Users\$User\Desktop
$Acl = Get-Acl
$Ar = New-Object system.security.accesscontrol.filesystemaccessrule("$User","ReadAndExecute","ObjectInherit,ContainerInherit","None","Allow")
$Acl.SetAccessRule($Ar)
Set-Acl -Path $Path -AclObject $Acl
Exit-PSSession}
錯誤:
The term 'C:\Users\$User\Desktop' is not recognizaed as the name of a cmdlet, function, script, file or operable program.