Command Shell Reference
SQL Queries
Welcome to TechNet Blogs Sign in | Join | Help
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

Posted: Thursday, November 19, 2009 1:50 AM by jtalmquist

Comments

Daniele Muscetta said:

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!

# December 13, 2009 1:03 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker