Scenario/Problem: You need to install SharePoint from PowerShell.
Solution: Use the Install-SharePoint
cmdlet from the SPModule
.
The first step in unattended installation and configuration is to install SharePoint onto the server. The SPModule
provides the Install-SharePoint
cmdlet to perform the installation. This cmdlet is used in conjunction with a setup configuration file that contains the installation parameters.
The SharePoint installation disc includes sample setup configuration files, located in their own folder within Files
, as shown in Figure 3.1. Listing 3.2 shows an example of the configuration file contents.
<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 the -->
from the back. Enter your SharePoint product key in place of Enter Product Key Here
. Save your changes.
You can 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>
Listing 3.3 shows a sample command-line entry.
Install-SharePoint -setupexepath D:setup.exe -configxmlpath
c:config.xml
SharePoint is installed on the server accordingly.
Tip
Install SharePoint on all servers that will participate in the farm (except for the database server) before configuring a new farm or joining an existing farm.
18.217.5.86