I have to bulk-add a large number of users to a role, to this extent I am using the Add-RoleMember cmdlet.

If I run

Add-RoleMember -Identity  "<role name>" -Members "name.lastname"

it works fine, however in our instance the users come from an Okta Membership Provider, where they are identified by their domain\email - such as


When I try to run

Add-RoleMember -Identity  "<role name>" -Members "domain\name.lastname@maildomain.com"

I am greeted with a:

"Error: The name is improperly formatted. The name can only contain the following characters: a-z, 0-9, periods, dashes, underscores, backslashes, and spaces."

So there is ABSOLUTELY no way of using Add-RoleMember if my user name contains an @ sign, even though the Role already contains users with such character in the name? I surely hope this isn't the case, otherwise I will have to handle everything through code, which means I won't be able to do this until the next deployment.


I can confirm this is a bug in the current release of Sitecore Powershell Extensions (4.1). There is some regex that is applied to account names and it looks like it is too restrictive.

As you have already opened an issue on the project, the bug will be tracked there - https://github.com/SitecorePowerShell/Console/issues/731

Hopefully I can shortly update this answer for future users, to say that the answer here is to upgrade to 4.2.

Your Answer

