Wednesday, November 12, 2014

Install SharePoint Foundation using PowerShell

Found this little stash of scripts (in the zip) on TechNet recently:

Install SharePoint Foundation 2010 by using Windows PowerShell

Having just finished the 2014 MVP Summit and getting my head full of PowerShell Desired State Configuration I thought I would be able to install SharePoint Foundation using DSC.

NOTE: I hope to post later on how to install the SharePoint prerequisites using the DSC Package Resource.

For now, here is the snippet for installing SharePoint Foundation using the DSC Package Resource:

configuration SharePoint

{

    node (hostname)

    {

        <#

        This is just a snippet of a larger configuration that I'm working on

        In the larger configuration I am installing of the SharePoint prerequisites, but still working on that

        I've left the 'DependsOn' parameter in to demonstrate how you would make the SharePoint install happen after its prereqs

        #>

        Package InstallSharePointFoundation

        {

            Ensure             = "Present"

            Name               = "Microsoft SharePoint Foundation 2013 Core"

            Path               = "C:\Temp\SharePointFoundation2013\Setup.exe"

            Arguments          = "/config C:\Temp\SharePointFoundation2013\files\setupsilent\config.xml"

            ProductID          = "90150000-1014-0000-1000-0000000FF1CE"

            ReturnCode         = 8

            DependsOn          = @(

                "[Script]AppFabricUpdate"

                "[WindowsFeature]ApplicationServer"

                "[WindowsFeature]WebWebServer"

                "[WindowsFeature]NetFramework45Full"

                "[Package]WcfDataServices5"

                "[Package]WcfDataServices56"

                "[xPendingReboot]BeforeSharePointInstall"

            )

        }

    }

}

 

SharePoint -OutputPath c:\temp\SharePoint

 

Start-DscConfiguration -Verbose -Wait -Path c:\temp\SharePoint

 

1 comment:

Sean McGovern said...

here is the windows features i've put together
$fimportalprereqwinfeatures="Web-Server","Web-WebServer","Web-Common-Http","Web-Static-Content","Web-Default-Doc","Web-Dir-Browsing","Web-Http-Errors","Web-App-Dev","Web-Asp-Net","Web-Net-Ext","Web-ISAPI-Ext","Web-ISAPI-Filter","Web-Health","Web-Http-Logging","Web-Log-Libraries","Web-Request-Monitor","Web-Http-Tracing","Web-Security","Web-Basic-Auth","Web-Windows-Auth","Web-Filtering","Web-Digest-Auth","Web-Performance","Web-Stat-Compression","Web-Dyn-Compression","Web-Mgmt-Tools","Web-Mgmt-Console","Web-Mgmt-Compat","Web-Metabase","Application-Server","AS-Web-Support","AS-TCP-Port-Sharing","AS-WAS-Support","AS-HTTP-Activation","AS-TCP-Activation","AS-Named-Pipes","AS-Net-Framework","WAS","WAS-Process-Model","WAS-NET-Environment","WAS-Config-APIs","Web-Lgcy-Scripting","Windows-Identity-Foundation","Server-Media-Foundation","Xps-Viewer"

WindowsFeature Net-Framework-Features
{
Ensure = "Present"
Name = "Net-Framework-Features"
source = "\\DSC-srv\INSTALL_FILES\net35\sxs"

}
windowsfeature NET-Framework-45-Features
{
Ensure = "Present"
Name = "NET-Framework-45-Features"
}
foreach ($winfeature in $fimportalprereqwinfeatures)
{
WindowsFeature $winfeature
{
Ensure = "Present"
Name = $winfeature
dependson = "[windowsfeature]NET-Framework-45-Features","[windowsfeature]Net-Framework-Features"
}
$prereqdependency+="[windowsfeature]$winfeature"
}

all that is left is the prerequisite software packages and configuring sharepoint.