我想为使用 C#(.NET 4.0)的特定用户组的 AD(Active Directory,Windows Server 2008 R2)OU设置List Content
和选项。List Object
我设法根据MicrosoftgPOptions
设置and属性,但我没有找到如何设置and的示例。设置其他两个属性的工作方式如下所示:gPLink
List Content
List Object
[...]
byte[] binaryForm = new byte[ groupPrincipal.Sid.BinaryLength ];
groupPrincipal.Sid.GetBinaryForm( binaryForm, 0 );
IdentityReference identityReference =
new SecurityIdentifier( binaryForm, 0 );
PropertyAccessRule propertyAccessRule =
new PropertyAccessRule(
identityReference,
AccessControlType.Allow,
PropertyAccess.Read,
new Guid( "...value provided by MSDN link..." ) );
...
// ouEntry is of type DirectoryEntry
ouEntry.ObjectSecurity.AddAccessRule( propertyAccessRule );
ouEntry.CommitChanges();
...
// Same for gPLink with the corresponding GUID
请询问您是否需要更多信息。