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)
Comments
- Anonymous
December 13, 2009
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!