'==========================================================================
'
'
' NAME: <ModifyUserProperties.vbs>
'
' AUTHOR: Ed Wilson , MS
' DATE  : 10/28/2003
'
' COMMENT: <Uses adsi to modify an User>
'
'==========================================================================
Option Explicit
Dim provider 'defines how will talk to active directory
Dim ou ' path to where object resides
Dim domain 'name of domain connecting to
Dim oCN 'name of object are creating
Dim oUname 'User name
Dim objUser 'holds connection to adsi

provider = "LDAP://"
OU = "ou=mred,"
domain = "dc=nwtraders,dc=msft"
oCN = "CN="
oUname = "myNewUser,"

Set objUser = GetObject(provider & oCN & oUname & OU & domain)
WScript.echo provider & oCN & oUname & OU & domain ' debug info
objUser.put "SamaccountName", "myNewUser"
objUser.put "givenName", "My"
objUser.Put "initials", "f."
objUser.Put "sn", "User"
objUser.Put "DisplayName", "My New User"
objUser.Put "description" , "simple new user"
objUser.Put "physicalDeliveryOfficeName", "RQ2"
objUser.Put "telephoneNumber", "999-222-1111"
objUser.Put "mail", "fff@hotmail.com"
objUser.Put "wwwHomePage", "http://www.fred.msn.com"

objUser.SetInfo

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