如何使用powershell编辑活动目录中对象类的默认安全性



根据Active Directory食谱,

Active Directory中的每个实例化对象都有一个关联的定义默认安全描述符(defaultSecurityDescriptor属性)。创建对象时默认安全描述符应用于它。这个,还有从父容器继承的权限,确定如何对象的安全描述符被初始定义。

可以在类属性的Default Security选项卡中的Active Directory SchemaMMC管理单元中编辑。

如何使用powershell编辑此默认ACL ?

(我比较喜欢用Get-ACL/Set-ACL,因为我比较熟悉)

这是不可能使用Get-ACL/Set-ACL,但是你可以这样编辑defaultSecurityDescriptor属性:

$adSchema = (Get-ADRootDSE).schemaNamingContext
$computerObject = Get-ADObject -SearchBase $adSchema -Filter "Name -eq 'Computer'" -Properties defaultSecurityDescriptor
$computerDefaultSecurityDescriptor = New-Object -TypeName System.Security.AccessControl.CommonSecurityDescriptor -ArgumentList @($false, $false, $computerObject.defaultSecurityDescriptor)
# make modifications to $computerDefaultSecurityDescriptor.DiscretionaryACL
# e.g. 
# $computerDefaultSecurityDescriptor.DiscretionaryAcl | where SecurityIdentifier -eq "S-1-3-0" | % $computerDefaultSecurityDescriptor.DiscretionaryAcl.RemoveAce($_)
$newSDDL = $computerDefaultSecurityDescriptor.GetSddlForm([System.Security.AccessControl.AccessControlSections]::All);'
Set-ADObject $ComputerObject -replace @{defaultSecurityDescriptor = $newSDDL}

最新更新