vHomeLab

virtualize everything!…

Menu

Skip to content
  • Exchange 2010
  • PowerShell
  • Active Directory
  • PowerCLI
  • vSphere

Tag Archives: Exchange 2010 Mailbox account script

Standard

Posted by

Vaseem Mohammed

Posted on

11/04/2011

Posted under

Exchange 2010, PowerShell

Comments

Leave a comment

Powershell Script : Creating Test Lab Mailbox Accounts in Exchange 2010

There are tons of Powershell scripts available over internet for creating accounts, I thought of writing my own article on this.

Nothing is changed much in this script.

Our goal is to have approximately 10 users in a given OU. Here is an OU named ISATown and will host 10 users.
Image-0010

Let me breakdown the script itself before we start writing it.
We will be using “New-Mailbox” Cmd-let to achieve our goal.
The parameters that’s required are
-Name: The name of the mailbox
-Database: In which mailbox database we want to create the mailbox
-Password: This parameter will take its value from a variable that we will define before we run the script.
-UserPrincipalName: The FQDN of user
-Alias: as it says by itself.
-Displayname: Yes, you are right.
-FirstName:
-LastName:
-SAMAccountName:

-OrganizationalUnit: the name of OU where we want to create users.

 

Lets define a variable to store password
$password = Read-Host “Enter Password” –AsSecureString
This will prompt us for password.
Image-0011

Now we will use Counter and ForEach Loop.
In the counter part we will specify the number of users we want to create, and will pipe it counter to ForEach Loop
1..10 | ForEach-Object

In ForEach-Object we will write the New-Mailbox script which will create mailbox user accounts.

1..10 | ForEach-Object { New-Mailbox  -Name BH$_ -Database MBDB02 -Password $password -UserPrincipalName BH$_@msexchange.in -Alias BH$_ -DisplayName BH$_ -FirstName BH -LastName User$_ -SamAccountName BH$_ -OrganizationalUnit ISATown }
Image-0012

The $_ is the current value in the pipeline.

Image-0013

Blog Stats

  • 92,440 hits

Follow me on Twitter

My Tweets
VCP6-DCV
Nutanix NPP

Recent Posts

  • Exchange 2019: New-MoveRequest Fail with error “Insufficient access rights to perform the operation”
  • VMware Horizon View – Remote Access Error : You are not entitled to use the system.
  • OVFTool.exe – Entry Point not found
  • ESXi 6.0 Nested Lab–NIC not detected
  • Synology DS1515+ SSD Cache (Read/Write)

Category Cloud

Active Directory ESXi Exchange 2010 Exchange Server Horizon View PowerShell SCCM VDI vmware VMWare Power CLI vSphere Windows 2003
Create a free website or blog at WordPress.com.
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Follow Following
    • vHomeLab
    • Join 68 other followers
    • Already have a WordPress.com account? Log in now.
    • vHomeLab
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar