AD Integration LDAP Queries

Here are some useful scripts to check and update AD Integration settings using the Command Shell.  Thanks to Lincoln Atkinson for helping me figure this one out.

Check current Ldap query

get-managementserver | where {$ -eq "fqdn"} | foreach-object {$_.getAgentAssignments()} | select LdapQuery

Update LDAP Query

$LdapQuery = "ldap_query"

$ms = get-managementserver | where {$ -eq "fqdn"}

$currentassignment = $ms.GetAgentAssignments() | where {$_.domain -eq "dn"}

$ms.EditAgentAssignment($currentAssignment.Domain, $LdapQuery, $currentAssignment.ExcludeList)


Command Shell Main Menu

Comments (1)

  1. Sweet. For some reason I thought the only method to check this would be to go and look at the rules that the wizard creates in the Deafalt MP.

    As much as I consider myself an "early adopter" of Powershell for opsmgr, I never realized that a ManagementServer object had that "GetAgentAssignments()" method which would return this information… well spotted!

Skip to main content