Computer Performance, Windows 2003, Exchange 2003, Logon Scripts

Guy recommends :
Free Solarwinds
VM Console

Solarwinds VM Console Free Download

Find out which of your VMs are a waste of space and which VMs need more resources.



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. 

See here for updated information VBScript create mailboxes

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.

Guy Recommends:  Solarwinds' Free Bulk Mailbox Import ToolFree Download Bulk Mailbox Import Tool

Import users, complete with mailbox from a spreadsheet.  Just provide a list of the users with the fields in the top row, and save as .csv file.  Then launch this FREE utility and match your Exchange fields with AD's attributes, click and import the users.  Optionally, you can provide the name of the OU where the new mailboxes will be born.

There are also two bonus tools in the free download, and all 3 have been approved by Microsoft:

  1. Bulk-import new users and mailboxes into Active Directory.
  2. Seek and zap unwanted user accounts.
  3. Find inactive computers.

Download your FREE bulk mailbox import tool.


See Also

 *


Custom Search

Guy Recommends: WMI Monitor and It's Free!Solarwinds WMI Monitor

Windows Management Instrumentation (WMI) is one of the hidden treasures of Microsoft operating systems.

Fortunately, Solarwinds have created the Free WMI Monitor so that you can actually see and understand these gems of performance information.  Take the guess work out of which WMI counters to use for applications like Microsoft Active Directory, SQL or Exchange Server.

Download your free copy of WMI Monitor

 

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

Please report a broken link, or an error.