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

A partial list of documented properties is available at office.microsoft.com/en-us/winsharepointadmin/HA011608451033.aspx.

There are many SharePoint timer jobs that you can view using the Operations tab from SharePoint Central Administration. You can also see the frequency of each job, but Central Administration provides no way to change this frequency or the time of day that the timer job runs. As I mentioned earlier, some jobs are controlled via a configurable property, but others are controlled via their own operation. For example, there are operations for controlling when the information management expiration policy runs (setpolicyschedule) and when profile synchronization occurs (setsearchandprocessschedule). These operations take a “recurrence string” as a parameter (e.g., “every 10 minutes between 0 and 59” or “daily at 13:00”). Therefore, if you need to kick off a task immediately, you use Stsadm to tweak its schedule. To find out what the syntax for using these recurrence strings are, look at the Help for setcontentdeploymentjobschedule.

Using Stsadm to Automate Tasks
Because Stsadm is a simple command-line utility, you can further simplify its use by wrapping it in a script or command file that can take parameters. You can also use the Windows Task Scheduler to schedule common tasks you perform with Stsadm. For example, you can schedule regular backups of particular site collections by placing the appropriate backup operations in a command file and scheduling the file to run at the appropriate times.

You can also leverage the output from some Stsadm operations. A simple example here is the enumsites operation that I mentioned earlier and its companion operation enumsubwebs. These output XML files are convenient fodder for many Web Parts. Therefore, if you schedule a task that enumerates your sites and directs the output of that task to a central file, you can use that file as input to a Web Part to display your up-to-date list of sites in a Web Part page.

Leverage the Command-Line to Extend SharePoint’s Web-Based Management
Stsadm is the SharePoint administrator’s friend. Whether you want to automate standard operations or perform tasks that are not so common, you can turn to Stsadm. If you haven’t already done so, I urge you to fire up that command prompt and see what Stsadm can do for you.