Executing SharePoint commands on the prompt

The STSADM tool provided by Sharepoint offers almost all features, which are available through the central administartion of Sharepoint (if not more!). This is especially useful, if you’re scripting certain actions, so you can do massive changes to your Sharepoint environment in a save way.

But once in a while, when you’re issuing commands via STSADM you might notice that they seem not to be carried out right away. Especially when deploying Sharepoint Solution Packages (.wsp) this can lead to unexpected errors. Assume you add a solution to the solution-store of sharepoint and want to deploy that solution globally:

STSADM -o addsolution -filename mysolution.wsp
STSADM -o deploysolution -name mysolution -immediate

Looking at the solutions in the central administration might show ERROR. But why? What did go wrong? Central administration doesn’t offer any further clues.

To get to the root cause you have to know how Sharepoint is actually handling the commands issued via STSADM. These commands are being queued and then asynchronously processed. This processing is done by a corresponding service. In some circumstances this service might not be running – most likely because it’s set to start manually instead of automatic.

So switching this service from manual to automatic should do the trick. But to be really sure, that the commands are being processed you can instruct STSADM to execute all currently queued commands right now. This is useful for instance in the example shown above, where the second command can only be processed after the successful completion of the first. So the solution might look like this:

STSADM -o addsolution -filename mysolution.wsp
STSADM -o execadmsvcjobs
STSADM -o deploysolution -name mysolution -immediate

Leave a Comment.