STSADM (Part 1)


This is the first of three STSADM posts we have planned.  This first post covers a number of commands that we commonly get questions about and/or use to resolve customer related issues.

Topics/Commands covered in this post:
Adding the path for stsadm (so you don’t have to navigate out to the bin folder anymore)
stsadm Preparetomove
stsadm setproperty peoplepicker
stsadm Execadmsvcjobs
stsadm Migrateuser
stsadm Sync
stsadm Job-immediate-alerts
stsadm Provisionservice
stsadm EditSSP

1. Index of stsadm commands:

http://technet.microsoft.com/en-us/library/cc263384.aspx

http://blogs.technet.com/josebda/archive/2008/03/15/complete-reference-of-all-stsadm-operations-with-parameters-in-moss-2007-sp1.aspx

2. Adding the path to system variable

This allows you to run stsadm command from anywhere in the file system.  You don’t have to change directories to c:\program files\common files\microsoft shared\web server externsions\12\bin.

Right click on My Computer

Choose Properties, Click the advanced tab | Environment Variables button.

Under System variables, double-click Path.

This is a list of paths separated by semi colons. Click in the Variable Value box and hit the "End" key to move the cursor to the end. Enter a semi colon (if there’s not already one there, and paste in the path: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN.

Test it by opening a command prompt, and from any path, enter stsadm -? This should list out the syntax and all the operations available for stsadm.

1

3. Some less common (but very useful) commands:

Preparetomove

Syntax:

stsadm -o preparetomove {-ContentDB <DatabaseServer:DatabaseName> | -Site <URL>} [-OldContentDB <uniqueidentifier>] [-undo]

Usage:

http://technet.microsoft.com/en-us/library/cc262122.aspx

— Should be run prior to moving a content DB to another web app within the farm, or moving a site collection from one content DB to another. The -Site switch is needed for the latter.

EX: stsadm -o preparetomove -contentdb m4:m4_MOSS_content -site http://m4/sites/team

2

Notes:

— If you do not run this command prior to moving the content database, you will get Profile synchronization errors with event IDs 5555, 5553, and 7888.

 

All peoplepicker commands:

http://technet.microsoft.com/en-us/library/cc263318.aspx

Peoplepicker-searchadforests

Syntax: stsadm -o setproperty

   -propertyname peoplepicker-searchadforests

   -propertyvalue <valid list of forests or domains>

   [-url] <URL>

Usage: http://technet.microsoft.com/en-us/library/cc263460.aspx

EX: stsadm -o setproperty -url http://m4 -pn peoplepicker-searchadforests -pv "forest:contoso.corp.com;domain:bar.contoso.corp.com", bar\admin, password

setproperty

Notes:

— Permits a user to search from a second one-way trusted forest or domain.

All servers in a farm need to be within one domain. Users in the forest that the server is in (that is, a resource forest) are displayed automatically. Forests that have at least a one-way trust to that forest can be searched for users to add.

— When a Web application uses Windows authentication, People Picker searches all two-way trusted forests and all two-way trusted domains. However, if you want to search from a one-way trusted forest or a one-way trusted domain, you must run the setapppassword operation, and then run the peoplepicker-searchadforests property.

— The peoplepicker-searchadforests property allows you to search multiple values from PeoplePicker. You can add multiple forests, domains, accounts, and even specific property searches.  In the above screen shot, two domains will be searched.

— As with all setproperty commands, if you enter the wrong property value or do not specify the URL, the tool will still come back and say "Operation completed successfully."  As a result, its best to test PeoplePicker to ensure that the command you entered is correct.

–In the above screen shot and syntax example, the quotation marks were moved around the entire property value (-pv).  This is done as it common for passwords to contain special characters that can cause the user specified to be unable to authenticate.

Execadmsvcjobs

Syntax: stsadm -o execadmsvcjobs

Usage: http://technet.microsoft.com/en-us/library/cc262783.aspx

EX: Stsadm -o Execadmsvcjobs

4

Notes:

— If you suspect a problem where timer jobs are not running on all WFEs, or if the SPAdmin service is disabled, run this command.

— Executes all administrative timer jobs immediately instead of waiting for the timer job to run.

When the process account for the Windows SharePoint Services Timer service (SPAdmin) is disabled (necessary in some installations for security reasons), the execadmsvcjobs operation must be run on all computers to perform provisioning and other administrative tasks that would ordinarily happen by using the Windows SharePoint Services Timer service (SPTimer).

Migrateuser

Syntax: stsadm -o migrateuser

   -oldlogin <domain\name>

   -newlogin <domain\name>

   [-ignoresidhistory]

Usage: http://technet.microsoft.com/en-us/library/cc262141.aspx

EX: stsadm -o migrateuser -oldlogin armory\User1 -newlogin armory\temp -ignoresidhistory

stsadm -o migrateuser -oldlogin armory\temp -newlogin armory\User1 -ignoresidhistory

Useful if user gets deleted and recreated in AD. You can migrate to a temp account, and then migrate back to the users real login name:

migrateuser

Notes:

— Migrates a user account in Microsoft Office SharePoint Server 2007 to a new login name and binary ID. If an entry for the new login name already exists, the entry is marked for deletion to make way for the migration. Migrates user access from one domain user to another.

— If ignoresidhistory is not specified, the SIDHistory attribute will be queried from Active Directory, to ensure that the account specified in ‘-oldlogin’ will be copied.

Sync

Syntax

stsadm -o sync {-ExcludeWebApps <web applications> | -SyncTiming <schedule(M/H/D:value)> | -SweepTiming <schedule(M/H/D:value)> | -ListOldDatabases <days> | -DeleteOldDatabases <days>}

Usage: http://technet.microsoft.com/en-us/library/cc263196.aspx

-ListOldDatabases

EX: stsadm -o sync listolddatabases 0

6

Notice there are a few that have not synched since 8/11/08, 7/25/08, and 12/10/08.

Note:

–This command lists the databases that have not synchronized with the SSP in zero days.

-DeleteOldDatabases

EX: stsadm -o sync deleteolddatabases 1

7

— This will delete synch records for all the content DBs that have not synched in the last 1 day.

8

Now as you can see we only show DBs that have synched with the SSP today.

-SyncTiming

• M:<# of minutes>

• H:<# of hours>

• Set back to default (h:1) when done testing.

EX: stsadm -o sync -synctiming m:5

9

Notes:

— This is useful for testing synch problems. You can set the synch schedule to every 5 minutes instead of every 1 hour.

Job-immediate-alerts

Syntax: stsadm -o setproperty

   -propertyname job-immediate-alerts

   -propertyvalue <A valid Windows SharePoint Services Timer service schedule>

   [-url] <URL>

Usage: http://technet.microsoft.com/en-us/library/cc262432.aspx

Ex: stsadm -o getproperty -pn job-immeditate-alerts -url http://m4

10

Ex: stsadm -o setproperty -pn job-immeditate-alerts -pv "every 1 minutes between 0 and 59" -url http://m4

11

Notes:

You can use this command to change the immediate alerts schedule (default 5 minutes). This is usful in testing alerts. You can change it to 1 minute so you don’t have to wait 5 minutes between each change to see if it’s fixed.

Provisionservice

Syntax:

stsadm -o provisionservice

   -action {start | stop}

   -servicetype <servicetype>

   [-servicename] <servicename>

Usage: http://technet.microsoft.com/en-us/library/cc262031.aspx

— Useful for search issues to either reprovision services, for example: the Osearch service, or Office Server Web Services.

First run stsadm -o enumservices > c:\services.txt

This will output all services in the farm to a text file. You need to do this so that you can copy the service type out and use it in the command.

12

Then you copy the text between the <Type> tags for the desired service (highlighted above) and paste it in as the -servicetype parameter in the command.

EX:

Stsadm -o provisionservice -action start -servicetype "Microsoft.Office.Server.Search.Administration.SearchAdminSharedWebService, Microsoft.Office.Server.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" -servicename SearchAdminSharedWebService

13

 

EditSSP

Syntax: stsadm -o editssp

   -title <SSP name>

   [-newtitle] <new SSP name>

   [-sspadminsite] <administration site URL>

   [-ssplogin] <user name>

   [-ssppassword] <password>

   [-indexserver] <index server>

   [-indexlocation] <index file path>

   [-setaccounts] <process accounts (domain\username)>

   [-ssl] <yes|no>

Usage: http://technet.microsoft.com/en-us/library/cc262727.aspx

EX: stsadm -o editssp -Title M4SSP -indexlocation c:\MossIndex

14

Notes:

This is useful for changing properties of the SSP. For example, it’s a good way to move the location of the search index.

4. Commands that are new (Between RTM and SP2) -  See STSADM (Part II)

5. Post-SP2 commands – See STSADM (Part III)


Comments (2)

  1. This is the second of three STSADM posts we have planned.&#160; This post covers commands that were new

Skip to main content