Command Shell Examples
Useful SQL Queries
AD Integration LDAP Queries - Jonathan Almquist on Operations Manager - Site Home - TechNet Blogs

AD Integration LDAP Queries

AD Integration LDAP Queries

  • Comments 1
  • Likes

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

I do not moderate this blog anymore. If you have a question regarding this post, send me a message.

Comments
  • 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!