共用方式為


Creating multiple Exchange Users and Public Folder for testing

  

I was just thinking for a load testing in my test environment.

I wanted few Hundred users to be created and few hundreds of Public Folder.

I wanted to this via Powershell as it is faster and less administrative work :)

 

If you want to create users for testing with the alias starting with test as the name and you want to create for example 50 users .

Here is a way to do that.

$p=read-host "enter the password" -assecurestring
$db=get-mailboxdatabase "databasename"

1..50 | % {new-mailbox -name ("test_{0:00}" -f$_) -database $db -userprincipalname ("test_{0:00}@domain.com" -f$_) -alias ("test_{0:00}" -f$_) -password $p}

Please do the following changes in the above script as per your environment

$db= Please specify a name of the database where you would want to have these test users hosted.

If we do not specify the database parameter in exchange 2010 then users would be created in random databases.

For exchange 2007 the database parameter is a mandate.

In the userprincipalname please change the domain.com to the name of your domain.

Please note that the Password which you would be mentioning in $p would be for all the 50 users.

If you want to create 500 Public folders with PowerShell with the name starting with folder under the folder called test folder

you would run the following command.

1..500 | %{New-PublicFolder -Name ("Folder_{0:0000}" -f $_) -path "\TEST FOLDER"}

If you want to create 500 Public folders with PowerShell with the name starting with folder under the root then

you would have to change the above command :

1..500 | %{New-PublicFolder -Name ("Folder_{0:0000}" -f $_) -path "\"}

Written by:

Naveen Vasudevan, Technical Lead, Enterprise Communications Services, Microsoft

Comments

  • Anonymous
    February 18, 2015
    This command is very usefull one. Thanks for sharing
  • Anonymous
    September 30, 2015
    Good work buddy. Thanks for sharing.