Powershell DSC and Sharepoint standalone installation

…this post was published on 2017 January 11.

Let’s take the next step, to install Sharepoint on the target machine.
First, one remark. What about GUI versus command line setup process?
If you preffer the <<click>> method, you will click clik, for couple of times to install the ​​product and to fill the key as well.

But you have an extra option, to install by command line the setup.exe. This can be done like this
> setup.exe /config config.xml

This xml file is a pre-defined file for multple scenarios, and these files can be found using /files folder,in sharepoint setup kit. There you will see multpile folders, each one with his config.xml file

For standalone server, which is for this topic, the folder is /setupsilent, and the .xml ​file looks like

 <Package Id=”sts”>
  <Setting Id=”LAUNCHEDFROMSETUPSTS” Value=”Yes”/>
 <Package Id=”spswfe”>
  <Setting Id=”SETUPCALLED” Value=”1″/>
 <Logging Type=”verbose” Path=”%temp%” Template=”SharePoint Server Setup(*).log”/>
 <!–<PIDKEY Value=”Enter Product Key Here” />–>
 <Display Level=”none” CompletionNotice=”no” />
 <Setting Id=”USINGUIINSTALLMODE” Value=”0″/>
 <Setting Id=”SETUP_REBOOT” Value=”Never” />
 <Setting Id=”SETUPTYPE” Value=”CLEAN_INSTALL”/>
where PIDKEY should be replaced by you with your own Sharepoint key; you should remove the comment <!– –> as well
Starting from the post, and I suppose that you already prepared the server with prerequisites, you could use the following script to prepare automatically the config.xml file and to install Sharepoint as Standalone on your target machine​.
The method, the third one ( after click,click and command line methods ) is using Powershell DSC
For this at the bottom of the article you will find 2 poershell scripts, zipped, which will execute the process with no action from you.
To use it, download the zip file and unzip it. This archive contains 2 file:
 i  – DSC_SP2013StandaloneMain.ps1
 ii – DSC_SP2013Standalone.ps1
The second one, DSC_SP2013Standalone.ps1  create the mof file needed to install Sharepoint. Few words about Package
       Package Sharepoint2013
            Name = “Microsoft Sharepoint 2013”
            ProductID = ‘90150000-1014-0000-1000-0000000FF1CE’
            pATH=(join-Path $SharePoint2013Path ‘\setup.exe’)
            arguments=’/config config.xml’
   Based on your Sharepoint installation kit, the Name and the ProductID could be different. To get the correct information, use regedit and browse for KEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall and there search for Sharepoint
More details about product ID , check this document​

 If the Product ID doesn’t match, you will receive at the end this error message, but the Sharepoint will be installed

$SharePoint2013Path variable is prepared in DSC_SP2013StandaloneMain.ps1 file, and represent the path for  the setup exe file . It will use the argument –   config.xml file, prepared in same  DSC_SP2013StandaloneMain.ps1 file.

The DSC_SP2013StandaloneMain.ps1 file will:
 – request the name for the target machine where Sharepoint 2013 will be installed;
 – prepare the shared folder  ( locally ) where Sharepoint 2013 kit will be copied with specific xml file , and you need to provide the folder name ( similar as in Prerequisites installation process );
 – will ask you for the SHarepoint kit location;
 – prepare config.xml, requesting the license key;
 – run DSC_SP2013Standalone.ps1 to prepare .mof files
 – set LCM on the target machine;
 – start the installation program , which it doesn’t need target machine to reboot;
 I recommend you to unzip the file ( at the bottom of this article ) in already existing working Powershell folder – c:\powershellscripts, and to run DSC_SP2013StandaloneMain.ps1
You can download the scripts here
ERRATA! ( until the next updates will come )
On line 38,39 please
replace sp2013 by your Domain name
replace “administrator” by a domain admin to permit rw to the shared folder

     New-SmbShare $folder_prerequisites -Path “c:\$folder_prerequisites” -ReadAccess “sp2013\$finalserver$” -Description “Sharepoint 2013 resources” -ErrorAction SilentlyContinue
    Grant-SmbShareAccess -Name $folder_prerequisites -AccountName “sp2013\administrator” -AccessRight Full  -Force
This entry was posted in DSC, Powershell, Sharepoint 2013. Bookmark the permalink.