Scripting a SharePoint 2010 install with Powershell

Clicking “next” “next” on an installer is sooo 2007.  If you stand up and take down SharePoint 2010 farms on a frequent basis (for development or test servers), or you want to be able to quickly do so (maybe for disaster recovery), you have two options.

1) Read through the documentation and figure it out on your own: Install SharePoint Server 2010 by using Windows PowerShell

2) Use the SharePoint 2010 Developer Workstation Easy Setup Script (and modify it for your needs)

or

3) Use the awesome whizbang killer AutoSPInstaller scripts on Codeplex: https://autospinstaller.codeplex.com/

This project consists of PowerShell scripts, an XML input file, and a standard windows batch file (to kick off the process) which together provide a quick and near-unattended installation and initial config (Service Apps, My Sites) of Microsoft SharePoint Server 2010. Works on both Windows 2008 and 2008 R2 (x64 only of course).

Perfect for repeated Virtual Machine-based installs/tear-downs, etc., but also great for production installs where you want to guarantee consistency and minimize data entry glitches. The immediate value is for installing and configuring the first/only server in a farm, but also supports using server-specific input files when running the script on subsequent servers (with parameters - e.g. for the service apps - set according to your desired topology).

"But doesn't SharePoint 2010 have a nice wizard now that does all this for me??" - Yes, and it's a huge improvement over what was available in MOSS 2007. However if you've ever seen the 'DBA nightmare' left behind on your SQL server after the Farm Configuration Wizard has completed (GUID'ed databases with inconsistent naming, etc.):

image
...then you'll see the value in having consistently-named but automatically-created databases:
image

The scripted process will:

  • Re-launch itself in an elevated process to deal with User Access Control
  • Check whether the target server is running Windows 2008 or 2008 R2
  • Prompt you to enter all most (in progress) service accounts, passwords and the farm passphrase, unless you opt to just specify them in the SetInputs.xml
  • Automatically download and install platform-specific pre-requisites (e.g. IIS, .Net Framework) using the SP2010 Prerequisiteinstaller.exe. You can also pre-download all the prerequisites/hotfixes using this script, then specify <OfflineInstall>1</OfflineInstall> in your SetInputs.xml instead of having Prerequisiteinstaller try to download fixes at script runtime.
  • Optionally disable some unnecessary Windows services
  • Install the SP2010 binaries using an (optionally, server-specific) config.xml for input
  • Create the Farm (Config & Central Admin content databases, Central Admin site, help collections, etc.)
  • Optionally configure and start many SharePoint services and service applications; currently the script can provision:
    • User Profile Service Application
    • User Profile Synchronization Service
    • Metadata Service Application
    • SharePoint Foundation User Code Service
    • State Service Application
    • WSS Usage Application
    • PowerPivot Service Application (Note: For this one, you'd need to first install your farm, then install the PowerPivot component for SQL2008 R2, then re-run the script with <CreatePowerPivot> set to 1)
    • Secure Store Service
    • Search Query And Site Settings Service
    • Enterprise Search Service Application
    • Web Analytics Service Application
  • Create the main Portal web app and site collection (will try to provision and/or assign a certificate, too - all you need is an https://-based URL in the input XML)
  • Create/configure your My Sites web app and site collection (will also try to provision and/or assign a certificate if you have an https://-based URL in the Input XML)
  • Launch IE to display the Farm Configuration Wizard, Portal and My Sites, and view the results of your hard work (just in time for your return from lunch)
  • Log all activity to a file on the current user's desktop, and pop open the log file for review when finished.

Get it here: https://autospinstaller.codeplex.com/