Computer Performance, Windows 2003, Exchange 2003, Logon Scripts

Guy recommends:
Free config generator

Solarwinds Config Generator

This CG will put you in charge of controlling changes to network routers and other SNMP devices.

Download your free Config Generator


 

VBScript - Create Mailboxes

Creating mailboxes with a VBScript

Two ways of creating users with mailboxes

There are two possible strategies, create users from scratch, or add mailbox attributes to existing accounts. 

Strategy 1

Create a new user complete with mailbox.  Build the complete user object from scratch, the result will be a mail-enabled user account.  For strategy 1, most of the work is done by CSVDE and Excel.  Create a spreadsheet and put the LDAP fields in the top row.

Part a)

In addition to the usual LDAP fields: dn, sAMAccountName, sn, givenName you need 5 extra Exchange mailbox fields.

Mail specific LDAP attributes

msExchHomeServerName

mail

mailnickname

homeMDB 

mDBUseDefaults

Import your spreadsheet with CSVDE -i -filename.csv -k

Part b)

Once the user has been created, then you need to set the password and activate the account.  See script below.

 

' Set Password.vbs
' VBScript to Set Passwords by cycling through a named OU
' Author Guy Thomas http://computerperformance.co.uk/
' Version 2.9 - March 10th 2004
' -----------------------------------------------------------------'
Option Explicit
Dim objOU, objUser
Dim strContainer, strLastUser, intCounter
strContainer = "ou=St Hilary, dc=CPEXCH,dc=com"
set objOU =GetObject("LDAP://" & strContainer )
intCounter = 0
   For each objUser in objOU
      If objUser.class="user" then
      objUser.SetPassword "P@ssw0rd"
      objUser.SetInfo
      objUser.Put "userAccountControl", "512"
      ObjUser.SetInfo
      intCounter = intCounter +1
      strLastUser = objUser.Get ("name")
   End if
next
WScript.Echo intCounter & " Passwords change. Last user " _
& strLastUser
WScript.Quit

 

Strategy 2

Strategy 2 Involves adding mailbox attributes to a user that already exists, but is NOT mail-enabled.  Such a user may have been imported from NT 4.0 by an Active Directory Connection agreement.

It is not easy building a VBScript which will add the necessary tabs in Active Directory Users and computers.  However, my ebook covers all the methods, and commands necessary to convert the user to a mailbox-enabled status.

Moreover, the ebook is dedicated to teaching more of the syntax, methods and commands to make you expert at VBScript.


Download your eBook: Creating Exchange mailboxes with VBScript- only $6.25

Creating Exchange mailboxes with VBScriptCreate mailbox-enabled users.  Add mailboxes to existing users in Active Directory.   Step-by-step instructions on how to use VBScript to generate users with mailboxes.  Combine VBScripts with CSVDE to import users from spreadsheets.

You get a printer friendly version with copy enabled, and no expiry date.  It runs to 55 A4 pages.

 

 


See Also

 .


Google

Webcomputerperformance.co.uk

GFi Events Manager

Guy Recommends: GFi EventsManager

Let GFI EventsManager do the dirty work! Have event logs monitored automatically and get warned about critical events! Download a copy here

 

Home Copyright © 1999-2010 Computer Performance LTD All rights reserved

Please report a broken link, or an error.