How to programaticaly in VBS add user to a domain with exchange mailbox?

  • Thread starter Thread starter Ales Baranek
  • Start date Start date
A

Ales Baranek

which parameters from AD I need to use? It is all of user attributes? How
can I find out other attributes?


Dim oContainer 'Parent container of new user
Dim oUser 'Created user
Set oContainer=GetObject("LDAP://OU=kastek,DC=kastek,DC=ub")
Set oUser = oContainer.Create("User","CN=Jo Brown")
oUser.Put "samAccountName","Jo"
oUser.Put "name","Jo Brown"
'oUser.Put "DN","CN=Jo Brown,OU=kastek,DC=kastek,DC=ub"
'oUser.Put "objectype","4"
oUser.Put "objectclass","user"
oUser.Put "samAccountName","Jo"
oUser.Put "displayname","Brown Jo"
oUser.Put "givenName","Jo"
oUser.Put "sn","Brown"
oUser.Put "mail","(e-mail address removed)"
oUser.Put "userPrincipalName","(e-mail address removed)"
oUser.Put "mailnickName","Jo"
oUser.Put "postalcode","68801"
oUser.Put "scriptPath","jo.bat"
oUser.Put "homeDirectory","c:\JO"
oUser.Put "homeDrive","c:\"
oUser.Put "homePhone","572696439"
oUser.Put "info","Jo Info"
oUser.Put "initials","JB"
oUser.Put "physicalDeliveryOfficeName","Physical Delivery"
oUser.Put "telephoneNumber","572638030"
oUser.Put "l","Test1"
oUser.Put "st","Morava"
oUser.Put "c","CZ"
oUser.Put "title","Ing."
oUser.Put "department","Odìlení"
oUser.Put "company","Extranet"
'oUser.Put "pwdLastSet",0
oUser.Put "streetAddress","Vlcnovska 2344"
oUser.Put "homeMDB","CN=Mailbox Store (KASTEK05),CN=First Storage
Group,CN=InformationStore,CN=KASTEK05,CN=Servers,CN=First Administrative
Group,CN=Administrative Groups,CN=First Organization,CN=Microsoft
Exchange,CN=Services,CN=Configuration,DC=kastek,DC=ub"
oUser.Put "legacyExchangeDN","/o=First Organization/ou=First Administrative
Group/cn=Recipients/cn=Jo"
Organizati\;o=Exchange\;s=Brown\;g=Jo\;"
oUser.Put "homeMTA","CN=Microsoft MTA,CN=KASTEK05,CN=Servers,CN=First
Administrative Group,CN=Administrative Groups,CN=First
Organization,CN=Microsoft
Exchange,CN=Services,CN=Configuration,DC=kastek,DC=ub"
Group/cn=Configuration/cn=Servers/cn=KASTEK05"
oUser.SetInfo
Set oUser = Nothing
Set oContainer = Nothing
WScript.Echo "Finished"
 
Back
Top