Wednesday, January 16, 2013

Troubleshooting STSADM Command Line Error message

The stsadm.exe that is used to administer SharePoint has terrible error handling. The only error message it seems to ever give when there is something wrong with the syntax is Command Line Error. If you get the syntax then you can get better error messages.

I checked, there is nothing in the Event Log, or any other SharePoint logs that I am aware of. So, what can you do?

Here are the basic things I would check when you get the dreaded Command Line Error from stsadm.exe.

  1. Make sure you spelled everything correctly
  2. Make sure you didn’t forget any parameters
  3. Make sure you didn’t forget the –o
  4. Check for extra or missing spaces

If you copied the code from anywhere (especially a web page, or MS Word or Word Pad or Outlook) here are some additional things. Rich text editors such as MS Word and web pages often try to “help” you by using proper typographical characters. The problem is they are not what you want to use for command line or coding in general. I have listed the special characters that often fall into this category and should be checked

  1. Use hyphens, not En Dash or Em Dash. For details on the differences, see here.
  2. Use double quotes, not smart quotes, curved, slanted, etc. For details on the differences, see here.
  3. Use single quotes, not smart quotes, curved, slanted, etc. For details on the differences, see here.

Don’t be fooled, sometimes you can’t visibly see the difference in Notepad or the like. They are valid characters so Notepad will still display them just fine. One way I know to fix the problem is to go and do a search and replace or manually retype all the suspected characters over to make sure they are right.

No comments: