'==========================================================================
'
'
' NAME: <ModifyOrganizationPage.vbs>
'
' AUTHOR: Ed Wilson , MS
' DATE  : 6/13/2006
'
' COMMENT: <Uses adsi to modify the organizational page information of user object>
'1.On the organizational page you can update all the properties below. Can Not
'2.Directly edit the directReports attribute. It comes from the manager attribute
'3.Of the affected users.
'==========================================================================
Option Explicit
Dim strProvider 'defines how will talk. 
Dim strOU ' path to where new object will be created
Dim strDomain 'name of domain connecting to
Dim strOUName 'User name
Dim objUser 'holds connection to adsi
Dim strManager 'holds manager name

strProvider = "LDAP://"
strOU = "ou=mred,"
strDomain = "dc=nwtraders,dc=msft"
strOUName = "CN=myNewUser,"
strManager = "cn=MyBoss,"

Set objUser = GetObject(strProvider & strOUName & strOU & strDomain)
WScript.echo strProvider & strOUName & strOU & strDomain ' debug info
objUser.Put "title", "Mid-Level Manager"
objUser.Put "department", "Sales"
objUser.Put "company", "North Wind Traders"
objUser.Put "manager", strManager & strOU & strdomain
objUser.SetInfo

If Err.Number = 0 Then
WScript.Echo("User " & strOUName & " was modified") 
Else
WScript.echo "an error occurred. it was: " & Err.Number
End If