System Center 2012 R2 – Register SPN fails

I received the following error wile pasting the command from my solution document.

C:\Windows\system32>SETSPN.exe -A MSOMSdkSvc/MyServer domain\service_account

Unknown parameter MSOMSdkSvc/MyServer. Please check your usage.

I have encountered this before and thought I would share the knowledge to save you some troubleshooting.

As you know the data access service account runs as a domain user and doesn’t have access to creation of the service principal names in Active Directory. There for you must run the commands with administrative or delegated privileges to user objects.

The syntax for adding SPN are two commands are found at TechNet http://technet.microsoft.com/en-us/library/dd548282.aspx

SETSPN.exe –A MSOMSdkSvc/<ManagementServerFQDN> <domain>\<SDKServiceAccount>

SETSPN.exe –A MSOMSdkSvc/<ManagementServerNetBIOS> <domain>\<SDKServiceAccount>

It is really tempting to just copy the lines and replace the information between <> with your data. But if you do you should know that there are issues with that. Windows and the command prompt or PowerShell interprets the minus character differently.

To display the differences I have copied and pasted the same line from Notepad, the command prompt and from PowerShell into Notepad++.

Plain

As you can see there are no differences between the lines but if I display the text in Hex you will see where the problem occurs.

HEX

The Hex code for minus sign hyphen is 2d which both PowerShell and command prompt delivers correct (marked in green). But the line pasted from notepad displays something different (marked in red).

That is the reason you will get the error message even if it looks correct.

One way to sort this in your documentation is to use the slash / (hex 2f) which displays the correct character in all three cases instead of the minus sign. Another way is to change the minus sign in the prompt.

2 Responses to System Center 2012 R2 – Register SPN fails

  1. MadMix says:

    Thanks a lot! I’ve typed again “-” and it worked!

  2. Ritesh says:

    Thanks a lot. This is really helpful.

Leave a comment