Benutzer-Werkzeuge

Webseiten-Werkzeuge


powershell:accessruleentfernen

Dies ist eine alte Version des Dokuments!


ACL AccessRule entfernen

function Remove-ACLAccessRule
{
	[CmdletBinding()]
	param
	(
		[Parameter(Mandatory=$true)][System.DirectoryServices.ActiveDirectorySecurity]$ACL,
		[Parameter(Mandatory=$true)][String]$AccessControlType,
		[Parameter(Mandatory=$true)][String]$IdentityReference,
		[Parameter(Mandatory=$true)][Int]$ActiveDirectoryRights,
		[Parameter(Mandatory=$true)][String]$ObjectGuid
	)
	begin 
	{
		$RuleToRemove = $null;
		$RuleFound = $false;
	}
	process 
	{
		foreach($Rule in $ACL.Access)
		{
			if ($Rule.AccessControlType.ToString() -eq $AccessControlType -and `
				$Rule.IdentityReference.ToString() -eq $IdentityReference -and `
				$Rule.ActiveDirectoryRights.value__ -eq $ActiveDirectoryRights -and `
				$Rule.ObjectType.ToString() -eq $ObjectGuid) `
			{
				$RuleToRemove = $Rule
				$RuleFound = $true;
			}
		}
	}
	end 
	{
		if ($RuleFound)	{$erg = $ACL.RemoveAccessRule($RuleToRemove)}
	}
}

powershell/accessruleentfernen.1471357875.txt.gz · Zuletzt geändert: 2016/08/16 16:31 von ronny

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki