This post is the second part of a two part step by step tutorial on how to install SharePoint 2019 in a fully automated way using PowerShell.
To read the first part, click here.
The SharePoint world is rapidly moving into the Cloud with SharePoint Online and Office 365, but a new SharePoint Server release was recently announced by Microsoft with improved hybrid support. To learn more about all the new features in SharePoint 2019, click here.
Before installing a SharePoint 2019 farm, it is important to be familiar with its requirements. To learn more about SharePoint 2019 hardware and software requirements, click here.
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 (to learn more about all the new features in SharePoint 2019, click here)
The example in this post is based on SharePoint 2019 with the following farm topology:
- 1 SharePoint 2019 Server
- 1 Database Server
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:|
-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.
|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.
|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.
- 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\Automation, assuming that the SharePoint 2019 installation files downloaded with AutoSPSourceBuilder were saved to C:\SP\2019.
This is the folder structure that AutoSPInstaler uses:
\SP\201x\SharePoint\<installation files & folders>
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\Automation.
After the AutoSPInstallerInput.xml file is configured, it’s time to install SharePoint!
IMPORTANT: the following steps should be executed using the sp_admin account.
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
The PowerShell script will start by validating all managed managed accounts configuration and if everything is OK, the SharePoint installation is started, beginning with the installation of all required prerequisites.
After prerequisites are installed, the script will install SharePoint.
The SharePoint installation assumes that all prerequisites were successfully installed. If any of the prerequisites was not successfully installed, an error similar to the following may occur.
To solve this error, there are two valid approaches:
- Run AutoSPInstaller from the beginning so that the missing prerequisite(s) are installed
- If the error remains, install the missing prerequisite(s) manually
If no errors occur or after the prerequisites errors are solved, the PowerShell script will continue to do its magic until all SharePoint binaries are installed.
After SharePoint binaries are installed, it’s time to configure the farm!
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
The PowerShell script will continue until the SharePoint farm is configured.
After the farm configuration is completed, the Central Administration will be opened and SharePoint is installed!
If you configured a web application to be created, the image below shows how a modern Team Site will look like in your SharePoint 2019 environment.
If you want to install SharePoint 2019 in multiple servers there is a number of considerations that you have to take into account. Some of the most important decisions are:
- What is your farm topology and the number of servers you want to consider (WFEs, Application Servers and Database Servers)
- Which services and service applications will be provisioned for each server
- Will you be using MinRoles or will you use a custom installation where you will be manually selecting the services and service applications that will be provisioned for each server?
If you use MinRoles, these will supersede the individual service and service application selection for each server in the farm. These are the available MinRoles:
- Distributed cache
- Single-server farm
- Front-end with Distributed Cache (merge of
Front-end and Distributed cache MinRoles)
- Application with Search (merge of Application and Search MinRoles)
Each of the MinRoles automatically provisions a specific set of services and service applications. If you want to learn more about MinRoles, click here.
Once farm topology and service/service application distribution is decided, we are ready to install SharePoint 2019 in multiple servers. For the installation process, you basically have two options:
- Use Remote Installation
- Install SharePoint individually in each SharePoint server
In this approach, SharePoint will be installed using AutoSPInstaller on all servers from one of the SharePoint servers. The script will first install SharePoint locally on the server where the script is being executed and will then install SharePoint remotely on the other servers (all at once or one by one depending on AutoSPInstaller configuration file). The installation on the remote servers is performed using PowerShell Remoting and Windows Remote Management (WinRM). WinRM must be enabled for each of the servers where SharePoint will be installed remotely. To learn more about Remote Install (example for SharePoint 2013 but valid for SharePoint 2019 in what regards to remote installation), click here.
Install SharePoint individually in each SharePoint server
This option doesn’t require WinRM to be enabled on any of the servers but requires instead that the AutoSPInstaller installation folder (C:\SP in this post) is copied to all servers. Additionally, there are some important notes to consider:
- SharePoint bits must be installed on all servers but farm configuration must only be done once all servers have the SharePoint bits installed. You may Install the SharePoint bits (all steps before the “Configuring the SharePoint Farm” in this post) in all servers at the same time but you must stop the installation process once you are asked to continue with farm configuration
- After the SharePoint bits are installed on all servers, you may proceed to the “Configuring the SharePoint Farm” section of this post BUT this must be done server by server, one at a time, sequentially. The AutoSPInstaller configuration file will determine what services and service applications are going to be provisioned on each server:
- When you run the farm configuration in the first server, the farm will be created and the services and service applications that are configured to run on that server will be provisioned
- When you run the farm configuration on the other servers, each server will be added to the farm and the services and service applications that are configured to run on that server will be provisioned
To read the first part of this two part step by step tutorial, click here.
If you are new to SharePoint and Office 365 and want to learn all about it, take a look at these learning resources.
If you are work in a large organization who is using Office 365 or thinking to move to Office 365 and is considering between a single or multiple Office 365 tenants, I invite you to read this article.
To learn more about all the new features in SharePoint 2019, click here.
If you want to know all about the latest SharePoint and Office 365 announcements from Ignite and some more recent announcements, including Microsoft Search, What’s New to Build a Modern Intranet with SharePoint in Office 365, Deeper Integration between Microsoft Teams and SharePoint and the latest news on SharePoint development, click here.