Automating and Scripting SharePoint Administration

First off let me thank Todd Klindt, my good buddy who’s shown me the light on the fact that IT Pro geeks really get into STSADM and the fact that you can get good scores showing off the black command line screen for over an hour.
I’ve used a few of his slides as inspiration (plus a bit, thanks buddy) for my talk here in Teched South East Asia.  Wish he was here doing this himself.  Maybe next year.
Here’s my Teched SEA Automating SharePoint Administration with STSADM deck.  Click "cancel" if you get prompted.
For my Scripted Administration talk I divided it up into 3 main sections.  1) Understanding the command line SharePoint Tools and other cmd line tools, 2) Understanding the containment hierarchy and it’s relationship to the stsadm commands 3) Things you can only do in STSADM and STSADM Extensions and Powershell
SharePoint Command Line Tools (Scripted Deployment more in previous post.)
  • Setup.exe
    • Install bits
    • Use Answer file to provide needed details to automate.
  • Psconfig.exe
    • Create or Connect to config db
       Start or stop services
       Change server roles
  • STSAdm.exe
    • Create Web Apps
    • Create Site Collections and sites
    • Backup/Restore
    • Import/Export
    • Maintenance and management
Non SharePoint Command Line Tools
IISWeb – query/create/delete empty IIS Web Applications (IIS Web Sites)
IISApp – List application pools with process id and use to recycle
Copy/Xcopy/Robocopy – Copy and Manage files.  There are various ways to connect and bulk upload.  Bamboo solutions has some nice very cheap import tools.  Beyond this there are a ton of third party tools for migrating data into SharePoint from BinaryTree, Tzunami, Quest, AvePoint and on and on.  Don’t forget Excel and Access and interfaces for getting list data into SharePoint.
Containment Hierarchy Creation and Management with Cmline tools
      (Setup.exe and Psconfig.exe) Setconfigdb, AddSolution (for farm solutions/features and below)
      (Setup.exe and Psconfig.exe) setconfigDB, addServer
Web Applications
      extendVS, extendVSinfarm, createAdminVS, createSSP, addcontentDB, AddZoneUrl, Managepolicypermissionlevel
     createDATABASE, createSSP, setconfigDB,
Site Collections (Site, SPSite)
     CreateSITE, CreateSITEinnewdb, AddUser, AddGroup
 Sites (Web, SubWeb, SPWeb)
     (automate list creation through list and site templates) (or with STSADM extensions or Access or Excel to add entire custom lists)
    (copy, xcopy, and robocopy can be used to add documents, use Excel and Access to insert or update items.)
   Quiesefarm, listlogginglevels, setlogginglevel, backuphistory
Web Applications
   preparetomove, unextendVS, addpath, editSSP
   DATABASErepair, preparetomove, AddContentDB
Site Collections (Site, SPSite)
   CreateSITE, CreateSITEinnewdb, GetSITElock, enumSITES
Sites (Web, SubWeb, SPWeb)
   createWEB, renameWeb, enumSUBWEBS
Advanced Cmdline Admin
STSADM Extensions – Gary Lapoint’s STSADM extensions are the most verbose list of extensions anywhere.  Tons of em.  My favorite… Createsiteindb (create site collection in existing database without all that unnecessary jumping around.)
Powershell – There are lots of powershell references out there now.  There’s one codeplex community project at  and Darrin Bishop (blog) did a session at TechEd called "ehancing automation with SharePoint" that I recommend.  There are quite a few other powershell projects on codeplex.
Caution: All those dispose concerns you might have heard about in development applies to anything you’re doing in Powershell.  There can be common mistakes with not properly disposing when walking the site tree.
Also check out SP1 and the Infrastructure update and future updates to include additional things… such as MergeContentdbs the most useful STSADM command for managing your databases.  You might not have heard of a SharePoint Admin Toolkit built by Microsoft.  The Move, Lock, and Delete in Batch in a web UI is very nice.
Other SharePoint Admin Tools should also be considered if you’re having manageability issues.  There is a lot of good work being done by third parties to make admin easier.
Additional References

TechNet STSADM Reference and Poster

Minsharp STSADM References (premium content)

Todd Klindt MVP blog

Ben Curry’s “SharePoint Admin Companion” (MS Press Book)

Gary Lapoint’s STSADM extensions

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: