Updating "manager" attribute in AD using a value queried from a sql db

rated by 0 users
Not Answered This post has 0 verified answers | 2 Replies | 1 Follower

Not Ranked
1 Posts
Eran posted on 01-18-2012 9:41 AM



I have a VB script which queries LDAP and SQL for values then writes the sql value to AD.

Since updating "manager" attribute in AD requires the DN of the user object, i'd like to use powershell in order to do it.

The queried value of the manager's name from sql is formatted as: FirstName(space)LastName

I need to use that value, convert its format to AD user account: FirstName.LastName

and write it back to AD using powershell.

The writing back to AD part in the VBScript is the following:

'**********update Manager**********


    objuser.put "Manager",SuperVisor


SuperVisor is the object representing the value queried from the SQL- FirstName(space)LastName

Manager is the object representing the ad attribute.


Hope someone can help me with this one!


Thanks in advance.

All Replies

Top 25 Contributor
296 Posts
Microsoft MVP
Top Contributor

If you want help with the whole script please post and it can  be translated

In etrms of updating an AD user's attribute see the script example at the bottom of this post


Not Ranked
6 Posts


To read Data from SQL you might find this Helpfull


As for Active Directory the Manager Attribute accepts only the distinguishedName of the Managers User Object - so you migth have to search for with something like this.


[System.DirectoryServices.DirectorySearcher]$adSearch=new-object System.DirectoryServices.DirectorySearcher(new-object System.DirectoryServices.DirectoryEntry)


if(($adManager -ne $null) -AND ($adEmployee -ne $null))

Page 1 of 1 (3 items) | RSS
Copyright 2012 PowerShell.com. All rights reserved.