Share via


STSADM (Part 2)

This is the second of three STSADM posts we have planned. This post covers commands that were new between RTM and SP2.

Topics/Commands covered in this post:
Renamesite
Mergecontentdbs
Setsiteuseraccountdirectorypath
peoplepicker-searchadcustomfilter
Trimauditlog

Renamesite

Syntax:

stsadm -o renamesite

   -oldurl <oldUrl>

   -newurl <newUrl>

Usage: https://technet.microsoft.com/en-us/library/cc263038.aspx
https://support.microsoft.com/kb/939535
Origin: https://support.microsoft.com/kb/939592 (Pre-SP1)

EX: stsadm -o renamesite -oldurl https://www.hhsitecol.com -newurl https://new.hhsitcol.org

In this screenshot, notice our host-named site collection is www.hhsitecol.com

15

After we run the command, the address will be updated.  The second screenshot (below) shows a refresh of the site collection list after the command was run. As you can see the site collection has been renamed to new.hhsitecol.org.

16

Notes:

-- See this about more for host named site collections:

https://technet.microsoft.com/en-us/library/cc288637.aspx

Mergecontentdbs

Syntax:

stsadm -o mergecontentdbs

   -url <URL name>

   -sourcedatabasename <source database name>

   -destinationdatabasename <destination database name>

   [-operation] {1-3}

      1 - Analyze (default)

      2 - Full database merge

      3 - Read from file

   [-filename] <file generated from stsadm -o enumsites>

Usage: https://technet.microsoft.com/en-us/library/cc262923.aspx

Origin: SP1

-- This can be used to move a site collection from one content database to another, or all site collections from one content DB to another.

-- If you don't want to move all site collections, mergecontentdbs needs to read the sites from an xml file.

To create the xml file, you must first run stsadm -o enumsites and pipe the output to an xml file:

https://technet.microsoft.com/en-us/library/cc262492.aspx

EX: Stsadm -o enumsites -url https://m4 > c:\sites.xml

17

Open the xml file you created and delete the lines for any sites you do not want to move. Also update the <Sites Count= tag to display the proper number of sites.

18

As you can see we have nine site collections in The M4_Content_2 database.  We removed all sites out of sites.xml except the one we want to move, https://m4/sites/team.  We have also updated the <Sites count> tag to be 1.

Now run the mergecontentdbs command.

EX: stsadm -o mergecontentdbs -url https://m4/ -sourcedatabasename m4_content_2 -destinationdatabasename m4_moss_content -operation 3 -filename c:\sites.xml

Now that we’ve run the command, you see that we have 1 site collection in M4_MOSS_Content. This is the 1 site that was listed in sites.xml (https://m4/sites/team)

19

WARNING: It is vital that backups are taken before this command is utilized.  If you plan to run this operation for a site collection that is approaching 10gb (or larger), or in a farm during high traffic periods, please see the following KB https://support.microsoft.com/kb/969242

Setsiteuseraccountdirectorypath

Syntax:

stsadm -o setsiteuseraccountdirectorypath

   -path <name of OU>

   -url <URL name>

Usage: https://technet.microsoft.com/en-us/library/cc263328.aspx

Origin: SP1

EX: stsadm -o setsiteuseraccountdirectorypath -url https://m4/sites/team -path "OU=Users,DC=Armory,DC=Local"

20

Notes:

-- This is used to set peoplepicker to only search within a specified OU instead of all of AD.

-- By default, you can only specify an OU that is within the same domain as the MOSS servers. However, if you install Feb CU, then you can specify OUs in trusted domains. See KB 967612 (https://support.microsoft.com/default.aspx?scid=kb;EN-US;967612) for more on that.

peoplepicker-searchadcustomfilter

Syntax:

stsadm -o setproperty

   -propertyname peoplepicker-searchadcustomfilter

   -propertyvalue <custom query string>

   [-url] <URL>

Usage: https://technet.microsoft.com/en-us/library/cc263452.aspx

Origin: SP1

EX: stsadm -o setproperty -url https://m4/sites/team -pn peoplepicker-searchadcustomfilter -pv (mail=*@armory.local)

21

Notes:

This allows you to set a custom filter to narrow your peoplepicker results. For example, you could have it return only users with the last name of "Roark".

-- This command will allow you to set invalid LDAP filters.  Please validate your filters before using them.

-- To ensure good performance, you should only filter on attributes that are indexed within Active Directory. To return a list of indexed attributes, see KB 230662 (https://support.microsoft.com/kb/230662)

Trimauditlog

Syntax:

stsadm -o trimauditlog

   -url <URL name>

   -enddate <YYYYMMDD>

   -databasename <database name>

   [-databaseserver] <database server name>

Usage: https://technet.microsoft.com/en-us/library/cc706879(TechNet.10).aspx

Origin: Infrastructure Update

EX: stsadm -o trimauditlog -date 20090315 -databasename m4_content_2 -databaseserver m4

22

Notes:

-- Allows you to delete records from the auditdata table in the content database you specify. Previously the only supported way to purge the auditdata table was to run OM code. This was a problem since many administrators used auditing turned on for all the options on all of their sites, causing the auditdata table to grow to as much as a couple hundred million rows, causing database sizes to swell, and performance to decrease.

 

STSADM (Part I)

https://blogs.msdn.com/spblog/archive/2009/06/18/stsadm-part-1.aspx

Comments

  • Anonymous
    June 22, 2009
    PingBack from http://stevepietrek.com/2009/06/22/links-6222009/

  • Anonymous
    February 25, 2011
    Peoplepicker-searchadcustomfilter applies to the entire web application, not to specific site collections, even if you specify a site collection in the url parameter.

  • Anonymous
    July 27, 2011
    my question is about the  mergecontentdbs command:  what if the source site/list name and the destination site/list names are the same? how can we make sure it does merge the content of  the sites having the same name Thanks