Skip to content

Instantly share code, notes, and snippets.

@ScriptingPro
Last active September 27, 2018 18:47
Show Gist options
  • Save ScriptingPro/6465b355ba77498389c92d0f1598ffd0 to your computer and use it in GitHub Desktop.
Save ScriptingPro/6465b355ba77498389c92d0f1598ffd0 to your computer and use it in GitHub Desktop.
AD/ADSI/LDAP MSExchange related queries (without using Exchange Management Shell cmdlets)
#Get Exchange Servers
Get-ADObject -SearchBase $(Get-ADRootDSE).configurationNamingContext -Filter {objectCategory -eq "msExchExchangeServer"}
# Find well-known Exchange groups in Active Directory
Get-ADObject $(Get-ADRootDSE).configurationNamingContext -Filter {objectclass -eq "msExchConfigurationContainer"} -Properties otherwellKnownObjects | select -ExpandProperty otherwellKnownObjects | %{$_.Split(":")[-1]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment