An Error Says the User Does Not Have a UserPrincipalName

You get an error--the user does not have a UserPrincipalName--but you want to enable Lync for the user. Here's how to fix it using ADSIEdit.msc.

John Savill

February 26, 2013

1 Min Read
An Error Says the User Does Not Have a UserPrincipalName

Q: While trying to enable a user for Lync, I get an error that the user does not have a UserPrincipalName--what can I do?

A: A valid UserPrincipalName (UPN) attribute value should look like an email address (e.g., [email protected]). If while you are trying to enable a user for Lync

PS C:> Enable-CsUser -Identity 'John Savill' -RegistrarPool savdalync01.savilltech.net -SipAddressType EmailAddress

you are receiving the error below, the likelihood is the user's UPN is not valid.


Enable-CsUser : ConstraintViolationStringDoesNotMatchRegularExpression(Pattern
that specifies a valid UserPrincipalName, john)
At line:1 char:1
+ Enable-CsUser -Identity 'John Savill' -RegistrarPool
savdalync01.savilltech.net  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Enable-CsUser], Exception
    + FullyQualifiedErrorId : Validation,Microsoft.Rtc.Management.AD.Cmdlets.E
   nableOcsUserCmdlet

Enable-CsUser : ConstraintViolationStringDoesNotMatchRegularExpression(Pattern
that specifies a valid UserPrincipalName, john)
At line:1 char:1
+ Enable-CsUser -Identity 'John Savill' -RegistrarPool
savdalync01.savilltech.net  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Enable-CsUser], Exception
    + FullyQualifiedErrorId : Validation,Microsoft.Rtc.Management.AD.Cmdlets.E
   nableOcsUserCmdlet

In the example above, the user's UPN is "john," which isn't a valid UPN. The easiest way to confirm and fix it is by using ADSIEdit.msc on a domain controller (DC).

Make sure the user has a valid UPN value. In the screen shot below, the value was "john" and I'm changing it in the String Attribute Editor to "[email protected]" (where savilltech.net is the name of the user's domain).

Fixing the UPN in the Attribute Editor

After the UPN is fixed, the command below to enable the user for Lync works without error (I'm using Windows PowerShell, as this user is a domain admin so the normal GUI doesn't work).

 

PS C:> Enable-CsUser -Identity 'John Savill' -RegistrarPool savdalync01.savilltech.net -SipAddressType EmailAddress

 

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like