Install SharePoint Unattended
Solution: Use the Install-SharePoint cmdlet from the SPModule.
The first step in unattended installation and configuration is to actually install SharePoint onto the server. The Install-SharePoint cmdlet is provided by the SPModule to perform the installation. This cmdlet is used in conjunction with a setup configuration file that contains the installation parameters.
Sample setup configuration files are included on the SharePoint installation disc. They are contained within their own folder within Files, as shown in Figure 3.1. An example of the configuration file contents is shown in Listing 3.2.
Figure 3.1 Sample configuration files are contained within the folders shown.
Listing 3.2. Sample Farm Setup Configuration File
<Configuration> <Package Id="sts"> <Setting Id="LAUNCHEDFROMSETUPSTS" Value="Yes"/> </Package> <Package Id="spswfe"> <Setting Id="SETUPCALLED" Value="1"/> </Package> <Logging Type="verbose" Path="%temp%" Template="SharePoint Server Setup(*).log"/> <!--<PIDKEY Value="Enter Product Key Here" />--> <Setting Id="SERVERROLE" Value="APPLICATION"/> <Setting Id="USINGUIINSTALLMODE" Value="1"/> <Setting Id="SETUPTYPE" Value="CLEAN_INSTALL"/> <Setting Id="SETUP_REBOOT" Value="Never"/> </Configuration>
Copy the config.xml file that matches your intended installation to a local drive location. Open the file in Notepad and uncomment the PIDKEY line by removing the "<!--" from the front and "--=" from the back. Enter your SharePoint product key in place of "Enter Product Key Here." Save your changes.
You may now use this configuration file with the Import-SharePoint cmdlet, which has the following syntax:
Install-SharePoint –setupexepath <path to setup.exe on disc> -configxmlpath <path to the setup config.xml>
A sample command-line entry is shown in Listing 3.3.
Listing 3.3. Installing SharePoint from the Command Line
Install-SharePoint –setupexepath D:\setup.exe –configxmlpath c:\config.xml
SharePoint will be installed on the server accordingly.
Installing Without a Product Key in the Configuration File
For security purposes, you may not want to store the product key within the configuration file. Instead you can use the –PIDKey parameter followed by your product key in quotes on the command line with the Install-SharePoint cmdlet, as shown in Listing 3.4.
Listing 3.4. Installing SharePoint from the Command Line with a Product Key
Install-SharePoint –setupexepath D:\setup.exe –configxmlpath c:\config.xml -PIDKey "ABDCE-FGHIJ-KLMNO-PQRST-UVWXY"