Anyone who does anything with SharePoint knows that the Stsadm.exe command is indispensible. It’s used for so many administrative, troubleshooting, and maintenance tasks. Problem is, it’s buried way deep down inside the Program Files directory, and you need to dig down to that location before you can start using the command. Here’s a great tip for making Stsadm easier to get to and easier to use.

1. Open Notepad and enter the following commands. Each bullet represents one line in the text file:

• @echo off
• set path=%path%;c:\program files\common files\microsoft shared\web server extensions\12\bin
• cd c:\
• @echo on

2. Save the file as “STSADM Command Prompt.bat” in a location accessible to both your normal user account and your administrative user account (if they are different). The batch file can be hidden away somewhere–but it’s important that you have permission to read the file as both your normal user account and your administrative account.

3. Create a shortcut to the batch file. Put the shortcut somewhere very accessible, like on your desktop or in your Start menu.

4. Open the properties of the shortcut. On the TARGET line, add to the beginning of the line: cmd.exe /k

5. Click the Apply button. Windows will change cmd.exe /k to c:\windows\system32\cmd.exe /k.

• The Target line will now read:
C:\WINDOWS\system32\cmd.exe /k “path\STSADM Command Prompt.bat” 

NOTE: path is a drive letter of the batch file where it is stored.

6. Click the Advanced button.

7. On Windows Vista or Windows Server 2008, select Run As Administrator. On Windows XP or Windows Server 2003, choose Run With Different Credentials (assuming you use a separate, administrative account to run Stsadm).

Double-click the shortcut. You’ll be prompted to run the shortcut with appropriate administrative credentials. Then a command prompt will open, set to the root of the C:\ drive (based on the third line in the batch file). Type path and press Enter. You’ll see that the system path now includes the folder in which Stsadm is found. That folder was added to the system path by the second line in the batch file.

Test the command prompt by typing STSADM /? and pressing Enter. You’ll see the usage information for Stsadm.exe displayed. Now you can use Stsadm commands to administer the server without having to dig into the deepest crevices of the Program Files folder.


~ by Neha Sinha on March 28, 2008.

5 Responses to “‘STSADM’”

  1. Thanks a Lot Neha
    I really works and help me out of the trouble.

    Hats Off

  2. Thanks Neha

    WOW its working grate

  3. good post neha !

  4. Good job Neha

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: