#153909 - 2005-12-22 04:35 PM
how to create exchange mailbox
|
jan
Getting the hang of it
Registered: 2004-07-07
Posts: 66
|
Hi,
I've made a script that creates new users on our AD, but I don't know how to create the users exchange mailbox. Until now we have made it manually (using "Exchange Tasks") but is't there a way you can make KIX make the mailbox?
I've tried to see on the UDF library but I couldn't find anything
Jan
|
|
Top
|
|
|
|
#153910 - 2005-12-22 04:59 PM
Re: how to create exchange mailbox
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
Here is a script I use to bulk create accounts. It includes a section for creating a mailbox...
Code:
Break On ; Distinguished Name of the OU where you want to create the accounts $objOU = GetObject("LDAP://OU=WI06,OU=Accounts,DC=your,DC=domain,DC=com") ; Tab-delimited text file containing the names for the accounts to create $sUserList = @SCRIPTDIR+"\AD_WI06.txt" If Not Open(1,$sUserList) $sUser = ReadLine(1) While Not @ERROR $Err='' $sUser = Split($sUser,Chr(9)) $sFullName = Trim(Join(Split($sUser[0],'"'),'')) $sLastName = Trim($sUser[1]) $sFrstName = Trim($sUser[2]) $sMdleName = Trim($sUser[3]) $sSAMName = Trim($sUser[4]) ; General Tab $objUser = $objOU.Create("User","cn="+Join(Split($sFullName,","),"\,")) $objUser.Put("givenName",$sFrstName) ; First name If Len($sMdleName) $objUser.Put("initials",$sMdleName) EndIf ; Middle initial $objUser.Put("sn",$sLastName) ; Last name $objUser.Put("displayName",$sFullName) $objUser.Put("description","User Account") $objUser.Put("physicalDeliveryOfficeName","MA07") ;$objUser.Put("telephoneNumber","") ; Account Tab $objUser.Put("userPrincipalName",$sFrstName+"."+$sLastName+"@@domain.com") $objUser.Put("sAMAccountName",$sSAMName) ; Profile Tab $objUser.Put("scriptPath","rz_logon.bat") ; Telephones Tab ;$objUser.Put("homePhone","") ; Address Tab $objUser.Put("c","US") ; Country $objUser.Put("countryCode",840) $objUser.Put("streetAddress","66 Sprague Street") $objUser.Put("l","Hyde Park") ; City $objUser.Put("st","MA") ; State $objUser.Put("postalCode","02136") ; Create Mailbox $msExchHomeServerName = "/O=domain/OU=World HQ/cn=Configuration/cn=Servers/cn=OH01MS42" $homeMDB = "CN=OH01MS42 SG4 MS5,CN=OH01MS42 SG4,CN=InformationStore,CN=OH01MS42,"+ "CN=Servers,CN=World HQ,CN=Administrative Groups,CN=domain,CN=Microsoft "+ "Exchange,CN=Services,CN=Configuration,DC=domain,DC=com" $objUser.Put("msExchHomeServerName",$msExchHomeServerName) $objUser.Put("homeMDB",$homeMDB) $objUser.Put("mDBUseDefaults",TRUE) $objUser.Put("mailnickname",$sFrstName+"."+$sLastName) $objUser.Put("mail",$sFrstName+"."+$sLastName+"@@domain.com") ; Commit changes to Active Directory $objUser.SetInfo If @ERROR $Err=$Err+','+@ERROR EndIf ; Set the password $objUser.SetPassword("domain1") If @ERROR $Err=$Err+','+@ERROR EndIf ; Enable "Change password on next logon" flag $objUser.Put("userAccountControl","512") $objUser.Put("pwdLastSet",0) $objUser.SetInfo If @ERROR $Err=$Err+','+@ERROR EndIf ; Place the user in the appropriate groups (must have DN of the groups) $objGroup = GetObject("LDAP://CN=group,OU=Accounts,DC=your,DC=domain,DC=com") $objGroup.Add($objUser.ADsPath) If @ERROR $Err=$Err+','+@ERROR EndIf $objGroup = GetObject("LDAP://CN=distributionList,OU=Distribution Lists,OU=Exchange,DC=your,DC=domain,DC=com") $objGroup.Add($objUser.ADsPath) If @ERROR $Err=$Err+','+@ERROR EndIf $sFullName + " " + $Err ? $sUser = ReadLine(1) Loop Else "Error "+@SERROR+" opening "+$Database ? Exit EndIf Get $ Exit 0
|
|
Top
|
|
|
|
#153911 - 2005-12-23 02:30 PM
Re: how to create exchange mailbox
|
jan
Getting the hang of it
Registered: 2004-07-07
Posts: 66
|
Thanks alot. I works :-)
|
|
Top
|
|
|
|
#153912 - 2006-08-29 05:59 PM
Re: how to create exchange mailbox
|
Gerald_G
Fresh Scripter
Registered: 2005-04-11
Posts: 34
Loc: Canada
|
Quote:
Here is a script I use to bulk create accounts. It includes a section for creating a mailbox...
Code:
; Create Mailbox $msExchHomeServerName = "/O=domain/OU=World HQ/cn=Configuration/cn=Servers/cn=OH01MS42" $homeMDB = "CN=OH01MS42 SG4 MS5,CN=OH01MS42 SG4,CN=InformationStore,CN=OH01MS42,"+ "CN=Servers,CN=World HQ,CN=Administrative Groups,CN=domain,CN=Microsoft "+ "Exchange,CN=Services,CN=Configuration,DC=domain,DC=com" $objUser.Put("msExchHomeServerName",$msExchHomeServerName) $objUser.Put("homeMDB",$homeMDB) $objUser.Put("mDBUseDefaults",TRUE) $objUser.Put("mailnickname",$sFrstName+"."+$sLastName) $objUser.Put("mail",$sFrstName+"."+$sLastName+"@@domain.com") ; Commit changes to Active Directory $objUser.SetInfo If @ERROR $Err=$Err+','+@ERROR EndIf Exit 0
Can someone further explain the meanings of this section for me ? I'm trying to figure out the /O and the CN= sections of the exchange server and home database lines.
I'd appreciate any further details.
gerald
|
|
Top
|
|
|
|
#153913 - 2006-08-29 06:48 PM
Re: how to create exchange mailbox
|
Gerald_G
Fresh Scripter
Registered: 2005-04-11
Posts: 34
Loc: Canada
|
Never mind - I think I found some help. Using LDIFDE to do an export, I was able to find the values of my installation.
LDIFDE –F [output file] –D [domain and/or container name] –L [attributes to export] –R [LDAP query filter for the database]
For example:
LDIFDE –F EXPORT-EXCHANGE1.TXT –D “DC=contoso,DC=com” –L msExchHomeServerName,homeMDB,homeMTA –R “(homeMDB=CN=DB1,CN=SG1,CN=InformationStore,CN=Exchange1,CN=Servers,CN=AG1,CN=Administrative Groups,CN=Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=contoso,DC=com)”
|
|
Top
|
|
|
|
#153914 - 2006-08-31 03:57 PM
Re: how to create exchange mailbox
|
Kaiminator
Fresh Scripter
Registered: 2006-08-28
Posts: 17
|
Quote:
Hi,
I've made a script that creates new users on our AD, but I don't know how to create the users exchange mailbox. Until now we have made it manually (using "Exchange Tasks") but is't there a way you can make KIX make the mailbox?
I've tried to see on the UDF library but I couldn't find anything
Jan
This is exactly my goal, what i wanted to do ;-) Can you paste your code here, so that the comunity gets benefit of it ;-)
|
|
Top
|
|
|
|
#153915 - 2006-08-31 04:20 PM
Re: how to create exchange mailbox
|
Witto
MM club member
   
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
I think the community is benefitting by reading the FAQs  Anyway, there is a description over there.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 735 anonymous users online.
|
|
|