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

domain\[email protected]

When I try to run

Add-RoleMember -Identity  "<role name>" -Members "domain\[email protected]"

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.

1 Answer 1


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

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.