Skip to content

Instantly share code, notes, and snippets.

@NiKiZe
Created September 23, 2025 17:23
Show Gist options
  • Select an option

  • Save NiKiZe/71053fa306109a9bfc4ae529800b4483 to your computer and use it in GitHub Desktop.

Select an option

Save NiKiZe/71053fa306109a9bfc4ae529800b4483 to your computer and use it in GitHub Desktop.
Add msExchHideFromAddressLists attribute to Active Directory
# https://learn.microsoft.com/en-us/previous-versions/office/developer/exchange-server-2007/aa565483(v=exchg.80)
$schemaPath = (Get-ADRootDSE).schemaNamingContext
$attributes = @{
adminDescription = 'ms-Exch-Hide-From-Address-Lists';
adminDisplayName = 'ms-Exch-Hide-From-Address-Lists';
attributeID = '1.2.840.113556.1.4.7000.102.73';
attributeSyntax = '2.5.5.8';
isMemberOfPartialAttributeSet = $true;
isSingleValued = $true;
lDAPDisplayName = 'msExchHideFromAddressLists';
CN = 'ms-Exch-Hide-From-Address-Lists';
oMSyntax = 1;
objectCategory = "CN=Attribute-Schema,$schemaPath";
objectClass = 'attributeSchema';
schemaIdGuid = New-Object Guid (, [byte[]](150,11,28,162,147,176,210,17,170,6,0,192,79,142,237,216));
searchFlags = 16;
attributeSecurityGuid = New-Object Guid (, [System.Convert]::FromBase64String("VAGN5Pi80RGHAgDAT7lgUA=="));
showInAdvancedViewOnly = $true;
}
New-ADObject -Name $attributes.CN -Type attributeSchema -Path $schemapath -OtherAttributes $attributes
$userSchema = Get-ADObject -SearchBase $schemapath -Filter 'name -eq "user"'
$userSchema | Set-ADObject -Add @{mayContain = $attributes.lDAPDisplayName}
@NiKiZe
Copy link
Author

NiKiZe commented Sep 23, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment