By: Matt Takhar | Last Updated: 2011-01-05 | Comments | Sharepoint
When SharePoint goes wrong or you need to do some "advanced" configuration, you are often referred to a tool called STSADM. This article gives you an overview of that tool.
Firstly lets clear up the name, STSADM stands for SharePoint Team Server Administration. (This is because many moons ago SharePoint was called Team Server. Those of you new to SharePoint will find Microsoft likes to change product names from time to time.)
STSADM is a command-line tool to help you administer SharePoint. It is more powerful than "SharePoint Central Administration" and allows you to script multiple commands. However, one small caveat here. Going forward Microsoft is encouraging us to use the new SharePoint PowerShell commands.
STSADM is located in your SharePoint (2007) installation directory, which is also often referred to as the SharePoint HIVE.
%COMMONPROGRAMFILES%\Microsoft Shared\Web Server Extensions\12\bin
C:\Program files\Common Files\Microsoft Shared\Web Server Extensions\12\bin
First tip - setting your Path
If you want to execute an STSADM command you have have to launch a command prompt (because it is a command line tool) and then navigate to the HIVE before then typing in the STSADM command.
A much better approach is to add the SharePoint HIVE to your operating systems Environment PATH variable. The net result of this will be the ability to execute STSADM from any location (it saves you navigating to the HIVE!).
- Connect to your SharePoint Server
- Load up "System Settings" (Right Click Computer and select Properties)
- Click the Advanced tab on System Settings
- Click Environment Variables
- On the Environment Variables dialog select the Path variable under System Variables. Click Edit.
- On the Edit System Variable dialog click the Variable Value field and press END on your keyboard.
- At the end of the Variable Value field enter the following
- ;C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN
- Note the semi colon at the beginning
- Also note the number 12, this the path for SharePoint 2007 or WSS 3.0. Change this to 14 for SharePoint 2010
Operations and help
Often overlooked... STSADM has help built in!
This is extremely useful especially if you are working on a server which is not allowed internet access. You can get help on the operation you are trying to execute by entering STSADM -help <operation name>
For example STSADM -help import, displays this:
This help output shows me I have to provide the -url and -filename parameters but all the other parameters surrounded by square brackets  are optional!
Here is a valid command using only the required parameters:
ÿSTSADM -o import -url http://sharepoint/HR -filename c:\temp\hr.cmp
Note: we have changed the -help parameter to -o. The o is short for operation.
Here is another example using one of the optional parameters:
ÿSTSADM -o import -url http://sharepoint/HR -filename c:\temp\hr.cmp -includeusersecurity
By the way, this particular command is great for exporting and importing sites across farms. The includeuserssecurity retains the permission structure on the import!
Here are a few other STSADM commands I use.
Review the deployed solution on the farm - help here
STSADM -o enumsolutions
Rename server - help here
STSADM -o renameserver -oldservername <oldservername> -newservername <newservername>
Manage the Office SharePoint Search- help here
STSADM -o search -action list
One last word of caution. Make sure you are very careful when using STSADM - you can break your SharePoint!
- Review the Microsoft STSADM help here
- Read the rest of my tips here
- Note: While this article shows the command (STSADM) in uppercase, the command is not case sensitive. Both STSADM and stsadm are correct.
Last Updated: 2011-01-05