Selectively running AutoSPInstaller scripts

If you’ve never used AutoSPInstaller (https://www.autospinstaller.com/) to setup SharePoint, I recommend you do so. It takes some of the annoyances out of SharePoint setup – for one, it allows you to name databases as you please instead of letting SharePoint attach GUIDs all over the place. And instead of having to go to multiple places/pages to get everything configured, all your configuration options are in one file.
It’s been awhile since I’ve needed to use AutoSPInstaller, and it’s even better since I’ve used it – instead of editing a XML file in Notepad you can now go through a wizard on their site. Simply copy the files AutoSPInstaller provides along with the SharePoint installer files into the locations it specifies and run the AutoSPInstaller launcher, and soon you’ll have your own little custom SharePoint environment!

Most of the time AutoSPInstaller works great by itself without the need to restart it. In the rare (read: my last attempt) event that it doesn’t and you need to rerun the installation script halfway through, good news – it is definitely possible! Each part of the AutoSPInstaller setup is a function, so we simply have to load the function declarations and your configuration into a SharePoint PowerShell window (as admin):


[xml]$xmlinput = (Get-Content "") -replace "localhost", $env:COMPUTERNAME
. "\AutoSPInstallerFunctions.ps1"

where <path to your XML file> is the path to your configuration file and <path to AutoSPInstaller folder> is where your AutoSPInstaller PowerShell scripts are stored. Notice the space in the second line between the period and the script path.

These commands load the AutoSPInstaller functions into memory and your configuration into a variable named $xmlinput. To continue your installation now all you have to do is open the AutoSPInstallerMain.ps1 file and look at the functions in the order which they are called, then run the functions as desired:

Example:

InstallLanguagePacks $xmlinput
InstallUpdates
ConfigureFarm $xmlinput

h/t to http://spinsiders.com/brianlala/2014/04/30/autospinstaller-for-specific-config-changes/

Leave a Reply