0 Pluspunkte 0 Minuspunkte

Ich möchte alle NTFS Berechtigungen mit Get-ACL anzeigen.

get-acl -path (get-smbshare dion | select path).path | foreach-object { $t = $_.Access; Write-Output "$($t.AccessControlType) $($t.IdentityReference)" }

Dabei wird aber nicht

Allow User1
Allow User2
Allow User3

ausgegeben sondern zuerst alle AccessControlType und danach alle IdentityReference.

Allow Allow Allow User1 User2 User3

Wie kann ich die Liste so ausgeben das jeweils IdentityReference und AccessControlType in einer Zeile stehen?

von  

1 Antwort

0 Pluspunkte 0 Minuspunkte

Das Problem liegt daran, dass $_.Access eine Liste von Berechtigungen ist und du mit $t.AccessControlType und $t.IdentityReference jeweils alle Werte auf einmal ausgibst. Stattdessen solltest du über jede Berechtigung einzeln iterieren.

get-acl -path (get-smbshare dion | select path).path | foreach-object { 

    $_.Access | foreach-object { 

        Write-Output "$($_.AccessControlType) $($_.IdentityReference)" 

    } 

}
von (1.0k Punkte)