Benutzer:MovGP0/Core Server/ACL

aus Wikipedia, der freien Enzyklopädie
   MovGP0        Über mich        Hilfen        Artikel        Weblinks        Literatur        Zitate        Notizen        Programmierung        MSCert        Physik      


User Permissions (ACL)

Listing User Permission Names

[System.Enum]::GetNames([System.Security.AccessControl.FileSystemRights])

$permission = [System.Security.AccessControl.FileSystemRights]::ReadAndExecute;

ACL Auslesen

$path = "\\path\to\object";
$acl = Get-Acl $path;
$acl | Format-List

Permission setzen

$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($path, $permission, AccessControlType::Allow);
$acl.SetAccessRule($AccessRule);

Permission entfernen

$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($path, $permission, AccessControlType::Allow);
$acl.RemoveAccessRule($AccessRule);

Alle Rechte von Nutzer entfernen

$usersid = New-Object System.Security.Principal.NtAccount("DOMAIN\USERNAME");
$acl.PurgeAccessRules($usersid);

ACL setzen

Set-Acl -Path $path -AclObject $acl