Mass Creating Users with SiteCore PowerShell Extensions

Have you ever had to create a lot of users in Sitecore? Maybe you are setting up a new Content Management server and the users will be managed in Sitecore and you have to set up all the new users? Or maybe you need to create a whole bunch of users for the testers to be able to check different types of functionality for different user roles? Or maybe conduct some performance testing?

All of the above was true for us and rather than going Sitecore > Security Tools > User Manager > New then type, type, type and click, click, click, we headed for SiteCore PowerShell Extension. Cos…

Sweet Brown


SPE includes a cmdlet to create a new user, rather aptly named: New-User

The command take a number of parameters for your new user:

New-User [-Identity] [-Password ] [-Email ] [-FullName ] [-Comment ] [-Portrait ] [-Enabled] [-PassThru]

For example:

PS master:\> New-User -Identity jammykam -Enabled -Password b -Email -FullName "Jammy KamSir"


Once your users are created you’ll want to add them to specific roles. Luckily, SPE also includes a cmdlet to do this: Add-RoleMember

The command take a number of parameters for your new user:

Add-RoleMember [-Identity] -Members

For example:

PS master:\> Add-RoleMember -Identity sitecore\unicorndevelopers -Members "jammykam","kamsar","whichoneisreal"

I thought this was about mass creating…

We recently had to create 50 new users as well as a bunch of test users. That’s right, ain’t nobody got time! The list was provided to us in Microsoft Excel, so I decided to use that to generate the above statements. We could export it as CSV and then loop through them in SPE… orrrrrr we could just use Excel to generate the statements for us instead! Yeah, you read that right!

Add a new formula in Excel, we’ll simply string concat the values provided to us:

="New-User -Identity " & B2 & " -Enabled -Password " & C2 & " -Email " & D2 & " -FullName """ & A2 &""""

Once a single line is set up, copy/paste the cell to the rest of the users:


Sorry, don’t have a clever Excel formula for this one, but no reason we cannot mass create single line statements like above:

="Add-RoleMember -Identity sitecore\unicorndevelopers -Members """ & B2 & """"

Now select the rows with the statement (F2-F4 above), copy and then paste into PowerShell ISE and execute the statements to add the users to the correct roles.


And that’s it, the users are created with the passwords specified and added to the specified role.

This could be expanded fairly easily to work with CSV. It was a one off task so for now this was a quick solution.

Eurgh, what the hell is this, Excel, bleurgh, vomit and other things…

Ok smarty pants. The above took 5 mins and zero brain power. So let’s do this from a CSV file instead.

Let’s run some SPE to upload/import the CSV, create the users and added them to the specified roles:

$VerbosePreference = "Continue"
$newUsersFile = Receive-File Path "C:\temp\upload" CancelButtonName "No, I will do it using MS Excel instead"
$newUsers = Import-Csv Path $newUsersFile
foreach($user in $newUsers) {
Write-Verbose "Creating User: $($user.Username)"
New-User Identity $($user.Username) Enabled Password $($user.Password) Email $($user.Email) FullName "$($user.Name)"
$($user.Roles).Split(",") | ForEach {
Write-Verbose "Adding user to role: $_ "
Add-RoleMember Identity $_ Members "$($user.Username)"

view raw
hosted with ❤ by GitHub

Name Username Password Email Roles
Jammy KamSir jammykam real Author,Developer
Fake Kam kamsar fake Developer,Experience Explorer
Real Unicorn Guy unicornguy B4D455 Sitecore Local Administrators

view raw
hosted with ❤ by GitHub

Happy now?


  1. Casey Royals · August 29, 2016

    Interesting article, thanks, unfortunately I don’t have access to SPE to do this. Is it possible to create a default user with the basic permissions that apply to all Authors, then add the specific sections of the website they are allowed to edit?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s