Ich möchte einige ACL Remote einstellen.Fern ändern ACL mehrere PC
Die Datei enthält test.csv
Computer und Benutzername. Ich denke, das Problem Feld zu passieren ist $user
innen Enter-Pssession
:
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}
Fehler:
The term 'C:\Users\$User\Desktop' is not recognizaed as the name of a cmdlet, function, script, file or operable program.