Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Create user with mailbox

Reply
 
Old 08-10-2008   #1 (permalink)
richard


 
 

Create user with mailbox

I'm trying to create users with mailboxes using vbscript.
I do have code which does this, but the problem lies with the number of E mail addresses that are
being automatically generated. The mail server will accept mail for domains:

a.mydomain.org
b.mydomain.org
c.mydomain.org
mydomain.org

and my newly created user has email addresses created for all those domains, ie:

TestUser01@xxxxxx
TestUser01@xxxxxx
and so on, but this isn't what I want. I need to be able to specify a single address for each newly
created user.

To achieve this, I've tried adding a line in my user creation script that specifies a single mail
address, such as :

objUser.PutEx ADS_PROPERTY_UPDATE, "proxyAddresses", Array("SMTP: TestUser01@xxxxxx")

but although the script runs without error, and the user gets created, they cannot login via OWA. If
I leave the previously mentioned line out, then user creation works,and the new user can get their
mail via OWA. However they have the extra unwanted mail addresses.

Could anyone tell me how to achieve the effect I want?

The script I'm using follows, although word wrapping may make it look a bit odd.

Regards,
Richard

/**********************/

Const ADS_PROPERTY_UPDATE = 2

Set objOU = GetObject("LDAP://ou=AutoCreated, dc=mydomain, dc=local")

Set objUser = objOU.Create("User", "cn=01TestUser")
objUser.Put "sAMAccountName", "01TestUser"
objUser.Put "givenName", "TestFirstName01"
objUser.Put "sn", "TestLastName01"
objUser.Put "displayName", "TestDisplayName"
objUser.Put "msExchHomeServerName", "/o=First Organization/ou=First Administrative
Group/cn=Configuration/cn=Servers/cn=MAIL"
objUser.Put "mail", "TestUser01@xxxxxx"
objUser.Put "mailnickname", "TestUser01"
objUser.Put "homeMDB", "CN=Mailbox Store Unlimited,CN=First Storage
Group,CN=InformationStore,CN=MAIL,CN=Servers,CN=First Administrative Group,CN=Administrative
Groups,CN=First Organization,CN=Microsoft
Exchange,CN=Services,CN=Configuration,DC=mydomain,DC=local"
objUser.Put "mDBUseDefaults", TRUE

'this line causes problems
objUser.PutEx ADS_PROPERTY_UPDATE, "proxyAddresses", Array("SMTP: TestUser01@xxxxxx")

objUser.Put "displayNamePrintable", "TestUser01"
objUser.SetInfo

objUser.Put "userPrincipalName", "TestUser01@xxxxxx"
objUser.SetPassword "abcdefg"
objUser.AccountDisabled = FALSE
objUser.SetInfo








My System SpecsSystem Spec
Old 08-11-2008   #2 (permalink)
richard


 
 

Re: Create user with mailbox

On Sun, 10 Aug 2008 13:37:14 +0100, richard@xxxxxx wrote:
Quote:

>To achieve this, I've tried adding a line in my user creation script that specifies a single mail
>address, such as :
>
>objUser.PutEx ADS_PROPERTY_UPDATE, "proxyAddresses", Array("SMTP: TestUser01@xxxxxx")
>
Problem solved.

It seems the space matters. Using
("SMTP:TestUser01@xxxxxx"

instead of
("SMTP: TestUser01@xxxxxx"

fixes the problem.

Richard
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Re: Powershell : Connect to the mailbox of a different user PowerShell
Re: List AD user with or without an Exchange Mailbox PowerShell
List AD user with or without an Exchange Mailbox PowerShell
Exch 2003, create Mailbox from Vista machine? PowerShell
How to create a mailbox in Exchange 2003 using Powershell PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46