How to install a SharePoint 2016 farm using PowerShell and AutoSPInstaller (Part 2)

Hello,

This post is the second part of a two part series where I will talk about a great way to install SharePoint in a fully automated way using PowerShell.

To read the first part, click here.

Introduction

Installing a SharePoint farm can be a complex task and the installation process is composed by a series of steps:

  • Downloading and installing SharePoint prerequisites
  • Downloading and installing the SharePoint binaries
  • Downloading and installing the lastest SharePoint updates
  • Downloading and installing the required language packs (optional, necessary if you want the SharePoint interface to be presented in a language other than English)
  • Configuring the SharePoint farm using SharePoint Products and Configuration Wizard

All the above steps are time consuming and can be error prone if, for example, you miss to download any of the prerequisites.

Fortunately, it is possible to fully automate a SharePoint farm installation using PowerShell by using a script called AutoSPInstaller. The installation process can be divided in two major steps:

  • Downloading the SharePoint installation package, click here for more details
  • Installing SharePoint and configuring the SharePoint farm

In this post, I will talk about the second part of the process: installing SharePoint and configuring the SharePoint farm.

AutoSPInstaller can be used to install a SharePoint farm in the following versions of SharePoint:

  • SharePoint 2010
  • SharePoint 2013
  • SharePoint 2016
  • SharePoint 2019 (still in Preview – to learn more about all the upcoming features in SharePoint 2019, click here)

The example in this post is based on SharePoint 2016.

Managed Accounts and Pre-Installation Requisites

This is a critical step to ensure a successful SharePoint installation. Before the AutoSPInstaller script is executed, all the necessary managed accounts must be created and the appropriate permissions must be properly granted to each account. If any of these permissions is not granted, you will probably encounter problems during the installation. From my experience doing SharePoint installations, creating these accounts with all the required permissions ensures a fast and successful SharePoint installation. Here is the list of accounts and required permissions:

Name Description Local Rights Domain Rights
sp_farm The server farm account is used to perform the following tasks:
-Configure and manage the server farm.
-Act as the application pool identity for the SharePoint Central Administration Web site.
-Run the Microsoft SharePoint Foundation Workflow Timer Service.
SecurityAdmin and DB_Creator rights on the SQL Instance Domain User
sp_admin The server farm account is used to perform the following tasks:
-Setup
-SharePoint Products Configuration Wizard
Local Administrator on all the SharePoint Servers. SysAdmin, SecurityAdmin and DB_Creator rights on the SQL Instance.
Must be na account with permissions to add rules to the local firewall.
Domain User
sp_pool The Pool account is used to run the Web Application Pools None Domain User
sp_services The Services Account is used to run the Service Application Pool None Domain User
sp_crawl The Default Content Access Account for the Search Service Application None Domain User
sp_search Service Account to run the SharePoint Search “Windows Service” Local Administrator and SysAdmin rights on the SQL instance Domain User
sp_mysitepool Used for the My Sites Web Application None Domain User
sp_userprofilesync The User Profile Synchronization Account None Replicate Directory Changes permission on the domain.
wf_service WorkFlow Manager Service Account Local Administrator and SysAdmin rights on the SQL instance. Domain User
sp_portalsuperuser Object Cache Service Account. The goals of the object cache are to reduce the load on the computer on which SQL Server is running, and to improve request latency and throughput. These user account must be properly configured to ensure that the object cache works correctly. None.
SharePoint: Must be an account that has Full Control access to the Web application.
Domain User
sp_portalsuperreader Object Cache Service Account. The goals of the object cache are to reduce the load on the computer on which SQL Server is running, and to improve request latency and throughput. These user account must be properly configured to ensure that the object cache works correctly. None.
SharePoint: Must be an account that has Full Read access to the Web application.
Domain User


Important Notes: 

  • To avoid problems executing the AutoSPInstaller script, ensure that the passwords of the above accounts do not contain any special characters (ex: $,%,&,/. etc)
  • The above table contains a proposal to name the accounts for the SharePoint installation. If you choose to use different names, ensure that the account names do not exceed 20 characters since NETBIOS names have a limit of 20 characters

Download AutoSPInstaller PowerShell script

To download the latest version of AutoSPInstaller, click here.

The files should be extracted to C:\SP\AutoSPInstaller, assuming that the SharePoint 2016 installation files downloaded with AutoSPSourceBuilder were saved to C:\SP\2016.

This is the folder structure that AutoSPInstaler uses:

\SP\AutoSPInstaller\AutoSPInstallerLaunch.bat

\SP\AutoSPInstaller\AutoSPInstallerInput.xml

\SP\AutoSPInstaller\AutoSPInstallerMain.ps1

\SP\AutoSPInstaller\AutoSPInstallerFunctions.ps1

\SP\AutoSPInstaller\AutoSPInstallerFunctionsCustom.ps1

\SP\AutoSPInstaller\AutoSPInstallerConfigureRemoteTarget.ps1

\SP\AutoSPInstaller\config.xml

\SP\201x\SharePoint\<installation files & folders>

\SP\201x\SharePoint\PreRequisiteInstallerFiles\

\SP\201x\SharePoint\Updates\

\SP\201x\LanguagePacks\xx-xx\ 

\SP\201x\LanguagePacks\xx-xx\Updates\ 

\SP\201x\Updates\


In this example, the root folder of the installation is C:\SP.

Creating the AutoSPInstaller configuration file

The next step, is to configure the AutoSPInstaller input configuration file that can be done in the AutoSPInstaller web site.  The end result of the configurations set in the AutoSPInstaller web site is the download of an XML file (AutoSPInstallerInput.xml) that contains all the settings required to configure the SharePoint farm. The AutoSPInstallerInput.xml file contains among other configurations:

  • SharePoint version to install
  • The SharePoint product key
  • The Farm Account and all Managed Accounts and their credentials
  • The database instance that will support the SharePoint environment
  • The web applications we want to create (ex: Intranet. My Site, etc)
  • The service applications we want to enable and their configurations
  • Outgoing email settings for the farm
  • Database names: this is extremely useful since it allows us to have complete control over the names of all the databases that will be created during the SharePoint farm configuration and avoid having databases with unclear names containing GUIDs which is the default behavior if we configure the farm using SharePoint Products Configuration Wizard (PSConfig)

The AutoSPInstallerInput.xml file should be placed in C:\SP\AutoSPInstaller.

Installing SharePoint

After the AutoSPInstallerInput.xml file is configured, it’s time to install SharePoint!

Follow the following steps:

1. Run AutoSPInstallerLaunch.bat from the command line (run as administrator)

AutoSPInstallerLaunch.bat will launch a PowerShell window that will install SharePoint and configure the farm using as an input the AutoSPInstaller XML configuration file (AutoSPInstallerInput.xml) previously configured using the AutoSPInstaller web site.

2. After the PowerShell window is launched, the following will happen:

  • Managed accounts credentials will be validated. If any of the credentials is incorrect, the script will stop
  • SharePoint prerequisites will be installed
  • SharePoint will be installed
  • SharePoint language packs will be installed
  • SharePoint updates will be installed

During the script execution. a message may be presented saying that the script needs to be re-launched to workaround an known issue with SharePoint 2016 when language packs are being installed.

After the script is re-launched, the installation will resume until all SharePoint binaries are installed.

Configuring the SharePoint Farm

After SharePoint is installed, the script will ask if we want to proceed with farm configuration. To proceed, select “y” and click ENTER. The script will, among others, perform the following actions:

  • Create all managed accounts
  • Configure IIS and SharePoint ULS log file paths
  • Create the configured web applications (ex: Intranet, My Site)
  • Configure the service applications
  • Configure outgoing email settings for the farm

After the farm configuration is completed, the Central Administration will be opened and SharePoint is installed!

 

AutoSPInstaller is also already available for the recently announced new version SharePoint, SharePoint 2019 (still in Preview). To learn more about all the upcoming features in SharePoint 2019, click here.

Happy SharePointing!

About the Author

Miguel Isidoro
SharePoint & Office 365 Senior Consultant | Create IT

Miguel Isidoro is a tech enthusiast, focused on Microsoft technologies, specially everything that is related to SharePoint and Office 365 and works with Microsoft and SharePoint technologies for more than 16 years, from SharePoint 2001 up until SharePoint 2016 and Office 365.

LinkedIn Profile: https://www.linkedin.com/in/miguelisidoro/

Leave a Reply

Your email address will not be published. Required fields are marked *