Stsadm in SharePoint

Using Stsadm you can perform the following tasks:

  • Createsite
     
  • Createsiteinnewdb
     
  • Createweb
     
  • Deletesite
     
  • Deleteweb
     
  • Enumallwebs
     
  • Enumsites
     
  • Enumsubwebs
     
  • Forcedeletelist
     
  • Getsitelock
     
  • Refreshdms
     
  • Refreshsitedms
     
  • Renamesite
     
  • Renameweb

Operation name: Createsite

Creates a site collection at the specified URL with the specified user as site collection owner and administrator.

Syntax


stsadm -o createsite -url <URL name> -owneremail <[email protected]>
[-ownerlogin <domain\name>]
[-ownername <display name>]
[-secondaryemail <[email protected]>]
[-secondarylogin <domain\name>]
[-secondaryname <display name>]
[-lcid <language>]
[-sitetemplate <site template>]
[-title <site title>]
[-description <site description>]
[-hostheaderwebapplicationurl <Web application URL>]
[-quota <quota template>]

If you want a new content database to be created with the new site, then Createsiteinnewdb Operation use.

Operation name: Createsiteinnewdb

Syntax

stsadm -o createsiteinnewdb -url <URL name> -owneremail <[email protected]>
[-ownerlogin] <domain\name>
[-ownername] <display name>
[-secondaryemail] <[email protected]>
[-secondarylogin] <domain\name>
[-secondaryname] <display name>
[-lcid] <language>
[-sitetemplate] <site template>
[-title] <site title>
[-description] <site description>
[-hostheaderwebapplicationurl] <Web application URL>
[-quota] <quota template>
[-databaseuser] <database user name>
[-databasepassword] <database password>
[-databaseserver] <database server name>
[-databasename] <database name>

Operation name: Createweb

This creates a subsite at the specified URL.

Syntax

stsadm -o createweb
-url <URL name>
[-lcid <language>]
[-sitetemplate <site template>]
[-title <site title>]
[-description <site description>]
[-convert]
[-unique]

Operation name: Deletesite

Deletes a site collection from a Web application.

Syntax

For deleting a live site collection:

stsadm -o deletesite
-url <URL name>
[-deleteadaccounts {True | False}]
[-gradualdelete]

For deleting an orphaned site collection:

-force
[-gradualdelete]
-siteid <site ID>
-databasename <database name>
-databaseserver <database server name>

Examples

stsadm -o deletesite -url http://server_name/sites/site_name -deleteadaccounts true

Operation name: Deleteweb

Deletes a subsite from a site collection.

Syntax

For deleting a live site within a site collection:

stsadm -o deleteweb
-url <URL name>

For deleting a site within an orphaned site collection or an orphaned site within a site collection:

-force
-webid <Web ID>
-databasename <database name>
-databaseserver <database server name>

Examples

stsadm -o deleteweb -url http://server_name/sites/site_name/subsite_name

Operation name: Enumallwebs

Displays the IDs and site map status for all site collections and subsites in the content database.

Syntax

stsadm -o enumallwebs
-databasename <database name>
[-databaseserver <database server name>]

Examples

stsadm -o enumallwebs -databasename DS_Database

Operation name: Enumsites

Displays a list of sites that are hosted in a Web application.

Syntax

stsadm.exe -o enumsites
-url <virtual server URL>
-showlocks
-redirectedsites

Operation name: Enumsubwebs

Lists the subsites that have been created immediately below a particular site.

Syntax

stsadm -o enumsubwebs
-url <URL name>

Operation name: Forcedeletelist

Allows a user to delete a list that might appear to be in a corrupted state.

Syntax

stsadm -o forcedeletelist
-url <URL>

Examples

stsadm -o forcedeletelist -url http://server_name/site_name/list_name


Operation name: Getsitedirectoryscanschedule

Displays the current schedule of all site directory links scan jobs to be run.

Syntax

stsadm -o getsitedirectoryscanschedule

Operation name: Getsitelock

Retrieves the lock status of a site.

Syntax

stsadm.exe -o getsitelock
-url <URL name>

Operation name: Refreshdms

Refreshes the Directory Management Service if a database is restored or moved to a location where the incoming e-mail settings are not correct.

Syntax

stsadm.exe -o refreshdms
-url <URL name>

Examples

stsadm.exe -o refreshdms -url http://server_name

Operation name: Refreshsitedms

Refreshes the Directory Management Service if a database is restored or moved to a location where the incoming e-mail settings are not correct.

Syntax

stsadm -o refreshsitedms
-url <URL name>

Examples

stsadm -o refreshsitedms -url http://server_name

Operation name: Renamesite

Changes a URL of a host-named site collection to a new URL.

Syntax

stsadm -o renamesite
-oldurl <oldUrl>
-newurl <newUrl>

Examples

stsadm -o renamesite -oldurl http://oldserver_name -newurl http://newserver_name

Operation name: Renameweb

Changes the URL of a subsite.

Syntax

stsadm -o renameweb
-url <URL name>
-newname <new name>

Examples

stsadm -o renameweb -url http://server_name/sites/site_name/subsite_name -newname NewWeb