Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


November 2007

Stsadm: Taking Control of SharePoint Administration

Use this command-line tool to customize and automate SharePoint management
RSS
Subscribe to Windows IT Pro | See More Scripting Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Executive Summary:
Previous Microsoft Office versions could be deployed using Group Policy Software Installation (GPSI). However, it's not recommended that you deploy Microsoft Office 2007 using GPSI. Instead, you must use Systems Management Server (SMS) or System Center Configuration Manager to do so, or find an alternative, more cost-effective deployment method.


Each new version of SharePoint has brought changes in the options for managing it via a graphical UI. The current versions of SharePoint—Windows SharePoint Services (WSS) 3.0 and Microsoft Office SharePoint Server (MOSS) 2007—provide a Web UI called Central Administration. This application lets you manage the Share- Point farm at different levels—from individual services on servers to Web applications to shared services.

However, some operations, for example changing the schedule of a background task or setting the diacritical sensitivity on a search index, aren’t exposed through the UI. To perform such operations, SharePoint administrators need to call upon the stsadm .exe command-line utility. Let’s look at what Stsadm is, some of the operations it supports, and how you can use it to automate common management tasks.

Stsadm
Stsadm has been shipping with SharePoint products since its inception. It helps IT pros perform operations that can’t be done through Central Administration and automate and batch operations that would take longer to complete using the Web interface. Indeed, the tool’s name alone gives us a clue to how long it’s been around: The first real SharePoint offering was called SharePoint Team Services (STS), and it primarily was managed via Stsadm.

Each SharePoint release has significantly extended the operations that Stsadm can perform, and today, MOSS has 183 operations that the utility can perform. You can extend the functionality of Stsadm by adding other operations to it, which is useful for third parties that layer applications on top of SharePoint. It’s also useful for extending the base capability of SharePoint. You can find information about how to extend Stsadm in the Windows SharePoint Services Software Development Kit (SDK) at www.microsoft.com/downloads/details.aspx?FamilyID=1c64af62-c2e9-4ca3-a2a0-7d4319980011&displaylang=en.

You’ll find Stsadm on any server that has had either WSS or MOSS installed on it. It’s located in the \%ProgramFiles%\Common Files\Microsoft Shared\web server extensions\12\BIN\ folder. That’s a long path to have to navigate to whenever you want to use Stsadm, so the first thing I recommend is to set up a command prompt short cut that starts in this folder. Note that to run Stsadm, you must be a member of the local Administrator’s group on the server.

You control what each operation does by passing it relevant parameters. You can see the syntax for each operation by opening a command line and typing

stsadm –help

You can dump the list of all operations by using Stsadm with no parameters. Microsoft provides more information about Stsadm at technet2.microsoft.com/Office/f/?en-us/library/5beaaf55-b77c-442d-88f5-eb9672f82e661033.mspx and technet2.microsoft.com/windowsserver/WSS/en/library/2c5896ac-edf6-4c2db750-995bbb66909c1033.mspx?mfr=true and via the WSS and MOSS SDKs, but the information isn’t complete. Therefore, trial and error may be required to achieve the desired result. You can also find documentation for commands that aren’t available from the UI at technet2.microsoft.com/Office/en-us/library/188f006d-aa66-4784-a65b-a31822aa13f71033.mspx?mfr=true.

The output of an operation will differ for each operation and may or may not be useful for automating common management tasks. For example, the enumsites operation, which enumerates the site collections in a Web application, produces XML output that you can subsequently parse to perform mass management tasks on all site collections. Figure 1, shows the site collections that were enumerated from a Web application whose URL is moss.spysrus.com/. Attributes within each XML node provide further information, such as the content database and storage limits associated with each site collection, so you could use this functionality to move all the site collections in one content database to another.

5 Favorite Stsadm Operations
It would be impossible to go through all 183 Stsadm operations, so here I highlight five of my favorites. I selected these operations because they’re likely to be used in most Share- Point installations.

MigrateUser. When a user is granted access to a site collection, certain details about the user are written to the UserInfo table in the back-end Microsoft SQL database. One such detail is the user’s SID, which ultimately controls access to the site collection. Should the user’s SID change for any reason—for example, if his or her AD account is moved to a different domain—the user loses access to existing site collections because the old SID is still in the database. You can use the migrateuser operation to fix the problem. This feature reads the old and new logon details and updates the relevant details in the database.

Createsiteinnewdb. Every site collection exists in only one content database. By this I mean that all the content from all the sites and subsites within the collection are stored in the same database. When you create a site collection through the UI or through the createsite operation in Stsadm, the content database that houses the collection is the one that is currently least full in terms of the number of site collections that it can host. The createsiteinnewdb operation is especially useful for situations when you want to target a particular site to a particular content database—for example, certain sites may have particular service level agreements (SLAs) associated with them and are therefore stored on separate SQL servers.

Backup. The backup operation lets you back up individual site collections as well as the entire farm (including search indexes) to disk. The ability to back up site collections is useful if you have crucial sites that need to be backed up more frequently than your regular backup. You can create a single file that contains everything within a site collection, and you can automate the backup through a scheduled recurring task. You can also use the export operation to produce a backup file that doesn’t contain the full contents of the site collection or farm. For example you can omit item versions, thus reducing the size of the backup file.

Restore. Of course having a backup of a site collection is pretty useless if you can’t restore the site collection if need be. The restore operation can take a file created using the backup operation and restore a full fidelity copy of the site collection, either by overwriting the existing site collection or creating a brand new site collection. This operation is useful for making copies of site collections for testing/debugging purposes (e.g., copying a production site collection to a test or staging farm).

SetProperty. The setproperty operation, along with its counterpart getproperty, is used to set attributes on many different SharePoint components. For example, you can use the jobusage- analysis property to control the frequency and time of day for usage-analysis processing on the server. Similarly, there are properties that control the frequency and time that the server sends out alerts. You can see a list of the configurable properties by typing the command

stsadm –o setproperty

   Previous  [1]  2  Next 


Reader Comments
WHy can I not see the full article (97107)??

I thought you had fixed this problem !

pbourgui October 31, 2007 (Article Rating: )


This article would be very useful if I could see the whole article. I can only see up to "common management tasks. . . . "

What is the deal??? Very frustrating considering that my customer number is associated with this online subscription.

pbreitenbeck April 01, 2008 (Article Rating: )


You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
Microsoft: Save Money ... By Paying for Software

Microsoft this week adopted an interesting tactic in its long-running battle with open source software: Businesses looking to save money over the long haul should simply pay for software instead of moving to free, open source solutions. The rationale? ...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

Microsoft Delivers Service Pack 2 Beta 2 for Vista, Server 2008

Microsoft on Tuesday announced the availability of the Beta 2 version of Service Pack 2 (SP2) for Windows Vista and Windows Server 2008. Since both operating systems were developed from the same code base, they have a common servicing structure and thus ...


Windows OSs Whitepapers Why SaaS is the Right Solution for Log Management

Related Events Introduction to Identity Lifecycle Manager "2"

Power Up! With Virtualization Online Conference

Protecting Mobile Users' Data

Check out our list of Free Email Newsletters!

Scripting eBooks Keeping Your Business Safe from Attack: Encryption and Certificate Services

Best Practices for Managing Linux and UNIX Servers

Building an Effective Reporting System

Related Scripting Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing