SPFarmInstaller – PowerShell Installation Scripts for SharePoint 2010
First off, let me say that the AutoSPInstaller project is great. It’s awesome that we have a community driven effort underway to automate SharePoint 2010 installation and configuration. But I recently started building out a fairly large and complex SharePoint farm and wasn’t happy with certain aspects of the AutoSPInstaller script. Specifically, I wanted a better configuration for a multi-server environment and I wanted more control over what was installed where.
So I put together a new set of scripts called SPFarmInstaller.
The core of SPFarmInstaller is the Farm Configuration XML file. Within this file you define everything about your farm. This is also the first key difference between SPFarmInstaller and AutoSPInstaller. With SPFarmInstaller you only have one farm configuration file. This file is the same regardless of which server you are working on.
Within your Farm Configuration File you define:
- Basic farm information like the DB server, Config DB name, outgoing email settings, etc.
- Managed accounts to be used by your services and application pools
- Servers in your farm and which services are running on them
- Service applications such as Search, MMS, etc
I’ll provide more detail on the Farm Configuration file in a future post.
The next step is to copy the XML File and the SPFarmInstaller scripts to each server in your farm. You will also want to make the SharePoint installation bits available to each server in your farm.
Next comes the second major change from AutoSPInstaller. Rather than one installation script that does everything, SPFarmInstaller has each step of the installation in a separate script. This gives you greater control over what you configure and when. It also makes it easy to snapshot your servers at each step of the way if you are using virtual machines.
So, there are 4 major scripts that you will use:
- 00-download-prereqs.ps1 – this script is optional and will download the SharePoint prerequisite files to the local server
- 01-install-bits.ps1 – this script must be run on each server in your farm. It will install the SharePoint bits (including prerequisites) but nothing else. It will not configure or join a farm. I like to run this script in parallel on all of my servers and then snapshot them so I have a clean installation of SharePoint I can roll back to if necessary.
- 02-create-or-join-farm.ps1 – this script is run first on your Central Admin server where it will create a new SharePoint farm and provision the Central Admin web app. After that it is run on each of the other farms in your environment joining each server to the existing farm. If you want you can stop now and continue configuring your farm by hand. But why configure by hand when you can use the next script?
- 03-configure-farm.ps1 – this is the last script to run and it should be run from the Central Admin server only. This script will set up your server topology (starting and stopping various SharePoint services on each server in your farm), create your web applications, and provision all service applications you have defined.
Check out the Read Me for detailed instructions on running these scripts.
As a warning, I wouldn’t consider this 100% complete just yet. I’m using it for building out several production farms so I know the code works for my needs. But I haven’t tested every configuration and option.
You can download the scripts here: https://github.com/glenc/SPFarmInstaller/zipball/master
Again, let me give full credit to the AutoSPInstaller project. Most of the functions and code in my scripts have been pulled from that project or greatly inspired by their approach.