Create Test Mailboxes (Powershell)

This Script creates 400 test mailboxes in the same Storage Group and OU.

All the users will have the same Password as you define it (must be inputed as secure string) and the same Name, For example : 

TestUser-1, TestUser-2...

Download The Script


# Author : Assaf Miron

# Http://

# Description :

# This Script Creates Test Mailbox Users in a specified Storage Group.

# The script creates all the users with the same Password and incrementing User Name.

# All The mailboxes are created in the same OU and is set to be hidden from address book.

# Input : Users Password

# Output: Test Users created

$FName = "Test"

$LName = "User"

$Password = Read-Host "Enter Users Password" -AsSecureString

$DBName = "MailSRV01\SG-TestUsers-DB"

$UserCount = 400

# Save current Execution Policy

$ExecutinPol = Get-ExecutionPolicy

# Dont show any Errors on Screen - Continue Silently

Set-ExecutionPolicy -ExecutionPolicy 0

For ($i=1;$i -le $UserCount;$i++)


$Account = $FName+$LName+$i

New-Mailbox -Alias $Account -Name $Account -DisplayName "$FName $LName - $i" -Database $DBName -FirstName $FName -LastName $LName -Password $Password -SamAccountName $Account -UserPrincipalName $Account"" -OrganizationalUnit "" | Set-Mailbox -HiddenFromAddressListsEnabled $true


# Return to the default Execution Policy

Set-ExecutionPolicy -ExecutionPolicy $ExecutinPol