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 {$_.name -eq "fqdn"} | foreach-object {$_.getAgentAssignments()} | select LdapQuery

Update LDAP Query

$LdapQuery = "ldap_query"

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

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

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

 

Command Shell Main Menu