【发布时间】:2018-07-13 01:52:33
【问题描述】:
这是上下文:我正在尝试为“Authenticated Users”组设置一堆属性。为此,我编写了以下脚本:
# GETTING AUTHENTICATED USERS SID
$sid1 = "S-1-5-11"
$objSID1 = New-Object System.Security.Principal.SecurityIdentifier($sid1)
# GETTING AUTHENTICATED ACL
$acl = Get-Acl -Path "AD:DC=*****,DC=*****"
# CREATING RULE ATTTIBUTES
$objectGuid = New-Object Guid 5f332e20-9eaa-48e7-b8c4-f4431fef859a
$identity = [System.Security.Principal.IdentityReference] $objSID1
$adRights = [System.DirectoryServices.ActiveDirectoryRights] "ReadProperty,WriteProperty"
$type = [System.Security.AccessControl.AccessControlType] "Allow"
$inheritanceType = [System.DirectoryServices.ActiveDirectorySecurityInheritance] "Descendents"
$inheritedobjectguid = New-Object Guid bf967aba-0de6-11d0-a285-00aa003049e2
# CREATING THE NEW RULE
$ace = New-Object System.DirectoryServices.ActiveDirectoryAccessRule $identity, $adRights, $type, $objectGuid, $inheritanceType, $inheritedobjectguid
# SETTING THE NEW RULE
$acl.AddAccessRule($ace)
Set-Acl -AclObject $acl "AD:DC=*****,DC=*****"
而最终的结果应该是这样的:
一个重要的事情是,我试图设置的是一个属性,而不是一个权限。并且该属性在所有计算机中都没有相同的 GUID,因为我在此之前使用另一个脚本创建了它。
问题如下:
在我设置$objectGuid 变量的代码中,我硬编码了我需要的GUID。我需要知道的是是否有任何方法可以使用 PowerShell 获取属性的 GUID。
【问题讨论】:
标签: windows powershell active-directory