SPSD SharePoint Solution Deployer
SharePoint Solution Deployer helps you to deploy SharePoint solution packages (.wsp) to multiple SharePoint environments. It deploys, retracts and upgrades one or more WSPs and can be extended to perform additional custom tasks in PowerShell before or afterwards. Unlike the most of the available scripts on the net, it performs all necessary prerequisite checks and post-deployment actions on all servers in the farm to assure the deployment runs smooth.
SPSD provides a simple XML configuration file which allows you to define the deployment environment by using variables i.e. to perform different actions on different urls depending to which farm you are currently deploying.
In the future, SPSD will provide a Visual Studio project template which can be added to your existing Visual Studio SharePoint project and recreates the deployment package on every build. Currently only the scripts are available which can be used independently.
For updates on SPSD follow us on Twitter or visit our blogs (links at the end of the page).
News
- 2015-04-09 (v5.0.4.6440) All current extensions included in package for convenience, clean-up in comments and code, based on latest code base from GitHub repository
- 2015-03-26 New extensions for creating managed/crawled properties, registering a custom crawl connector and creating target applications in the securestore available on GitHub along with bugfixes. Thanks Bernd Rickenberg for contributing!
- 2014-08-26 SourceCode moved to GitHub, added several sample extensions
- 2014-01-04 (v5.0.3.6438) All new extensions system, executable in custom host, bugfixes and improvements (see release notes) (Note! The Environment Editor GUI has not yet been updated)
- 2013-08-27 (v4.2.1.2349) Many new features and some bugfixes (see release notes)
- 2013-04-23 Review: The pain & gain of SharePoint solution deployment process, part 4 – Getting started with SharePoint Solutions Deployer (SPSD) by @avishnyakov
- 2013-03-17 SPSD is now the standard deployment package in the SharePoint Software Factory
- 2013-02-01 (v4.1.1.2346) Loads of bugfixes and some new features (see release notes)
- 2013-01-17 (v4.1.0.6928) Minor update fixes issues when remoting to servers in farm
- 2013-01-14 (v4.1.0.5292) New release featuring the new SPSD Environment file editor and many changes and bugfixes (see release notes)
- 2012-12-18 (v4.0.3.8989) Minor update to fix AllowCASPolicy/AllowTrustBindeployment switch in SP15
- 2012-11-28 (v4.0.3.8623) Updated support for SP2013 RTM and latest SP2010 CU
- 2012-08-08 (v4.0.3.2932) Initial release of the re-write of SPSD in PowerShell
How to use it:
- Download SPSD, unblock the file and unzip it
- Drop your WSP files into the "Solutions" folder
- Run Deploy.bat
For more detailed control over the deployment process create your own environment XML file
Features
- NEW! Extensible with custom extension scripts!
- Deploys, retracts and updates one or multiple WSPs
- Supports Farm and Sandboxed solutions
- Checks prerequisites before deployment (i.e SharePoint version/license, installed WSPs, Admin permissions, remote access to all servers in the farm, services running, installed language packs etc.)
- Optionally runs your custom PowerShell scripts or commands during deployment
Available targets:- BeforeDeploy, AfterDeploy,
- BeforeRetract, AfterRetract,
- BeforeUpgrade, AfterUpgrade
- Initialize, Finalize, ProcessSolution
- RunCustomPrerequisites, CheckCustomPreconditions
- Optionally performs actions on one or all | webfrontend | application servers (by using PSRemoting) in the farm, e.g.
- IISreset,
- Recycle AppPools,
- Restart services like SPTimerV4, SPAdminV4, SPUserCodeV4 or custom services
- Warmup server urls (avoids the load balancer to warmup on all machines in the farm)
- Easy configurable for different environments (create custom environment configurations which are automatically used based on conditions like machine or user name)
- Possibility to split the environment definition in multiple files to reuse parts for different target farms (DEV, INT, UAT, PROD)
- Easy-to-use environment file editor helps editing configuration file
- Detailed deployment log file
- Implemented entirely in PowerShell (2.0 or higher required)
- Supports SharePoint 2010 and 2013
SPSD is the standard template for deployment included in SPSF SharePoint Software Factory at http://spsf.codeplex.com.
Documentation:
Sample Output (PowerShell Console):
* SharePoint Solution Deployer (SPSD) *
* Version : 4.0.3.2932 *
* Url : http://spsd.codeplex.com *
* Started on : 08/08/2012 12:01:22 *
* *
* Command : Deploy *
* Type : All *
* Machine : SP15MEIPREV01 *
* User : CSI\MEIDEV *
*******************************************************************************
Prerequisites
Loading SharePoint Powershell Snapin
Loading WebAdministration Powershell Snapin
Loading deployment environment configuration
Loading default environment from '.\Environments\Default.xml'
Loaded 'Configuration' node with 'ID'='Default' from '.\Environments\Configuration.xml'
Saved complete environment XML to '.\Environments\Environment-2012-08-08_12-01.xml'
Checking System Preconditions
Checking if PowerShell Remoting is enabled on server 'SP15MEIPREV01'
PowerShell Remoting not required on local machine...Skipped
Checking permissions
Checking if user 'CSI\MEIDEV' is farm administrator...Ok
Checking if user 'CSI\MEIDEV' is local administrator on 'SP15MEIPREV01'...Ok
Checking minimal required SharePoint version...Ok
Minimal version : 14.0.0.0
Installed version : 15.0.4128.1014 (SharePoint 2013 Preview)
Checking minimal required SharePoint license...Ok
Minimal License : Foundation
Installed Licenses : SharePoint Foundation 2013 (Preview) Foundation
SharePoint Server 2013 Enterprise (Preview) Enterprise
Checking services for deployment
Ensuring SharePoint Administration (SPAdminV4) is running...Running
Ensuring SharePoint Timer Service (SPTimerV4) is running...Running
Checking if LoopbackCheck is disabled on server 'SP15MEIPREV01'...Disabled
Checking prerequisite solutions
Not configured
Checking System Preconditions finished
Begin solution deployment
Begin custom BeforeDeploy target
Getting solution files to deploy
Checking if solution files exist in '.\Solutions' folder
TestSolutions.Sandboxed.wsp...Exists
TestSolutions.WebApplication.wsp...Exists
TestSolutions.GAC.wsp...Exists
Checking if specified Sites and Web Applications exist
WebApp: 'http://collaboration.sp15meiprev01.csi.local'...Ok
WebApp: 'http://sp15meiprev01.csi.local'...Ok
Site: 'http://collaboration.sp15meiprev01.csi.local'...Ok
Site: 'http://sp15meiprev01.csi.local'...Ok
Deploying:
'TestSolutions.WebApplication.wsp' (farm solution)
Solution already exist and overwriting set to true
'TestSolutions.WebApplication.wsp' (farm solution)
Retracting...Done
Waiting to finish retraction.................Finished
Removing solution...Ok
Checking retraction...Ok
Adding solution...Ok
Deploying to 'http://collaboration.sp15meiprev01.csi.local/', 'http://sp15meiprev01.csi.local/'Done
Waiting to finish job 'solution-deployment-testsolutions.webapplication.wsp-0'.............Finished
Checking deployment...Ok
'TestSolutions.GAC.wsp' (farm solution)
Adding solution...Ok
Deploying globally...Done
Waiting to finish job 'solution-deployment-testsolutions.gac.wsp-0'................Finished
Checking deployment...Ok
'TestSolutions.Sandboxed.wsp' (sandboxed solution)
Deploy to 'http://collaboration.sp15meiprev01.csi.local'
Sandboxed solution already exist and overwriting set to true
'TestSolutions.Sandboxed.wsp' (sandboxed solution)
Retract from 'http://collaboration.sp15meiprev01.csi.local'
Retracting...Done
Waiting to finish retraction....Finished
Removing sandboxed solution...Ok
Checking retraction...Ok
Adding solution...Ok
Deploying...Done
Waiting to finish deployment....Finished
Checking deployment...Ok
Deploy to 'http://sp15meiprev01.csi.local'
Sandboxed solution already exist and overwriting set to true
'TestSolutions.Sandboxed.wsp' (sandboxed solution)
Retract from 'http://sp15meiprev01.csi.local'
Retracting...Done
Waiting to finish retraction....Finished
Removing sandboxed solution...Ok
Checking retraction...Ok
Adding solution...Ok
Deploying...Done
Waiting to finish deployment....Finished
Checking deployment...Ok
Running 'Deployment' actions
Restarting services
Restarting (SPTimerV4) in farm
Restarting on SP15MEIPREV01...Done
Ensuring SharePoint Timer Service (SPTimerV4) is running...Running
Restarting (SPAdminV4) in farm
Restarting on SP15MEIPREV01...Done
Ensuring SharePoint Administration (SPAdminV4) is running...Running
Restarting (SPUserCodeV4) in farm
Restarting on SP15MEIPREV01...Done
Ensuring SharePoint User Code Host (SPUserCodeV4) is running...Running
Resetting Internet Information Servers (IIS) in farm
Resetting IIS on SP15MEIPREV01
Attempting stop...
Internet services successfully stopped
Attempting start...
Internet services successfully restarted
Getting status for IIS on SP15MEIPREV01...Done
Status for IIS Admin Service ( IISADMIN )...Running
Status for Windows Process Activation Service ( WAS )...Running
Status for Net.Msmq Listener Adapter ( NetMsmqActivator )...Running
Status for Net.Pipe Listener Adapter ( NetPipeActivator )...Running
Status for Net.Tcp Listener Adapter ( NetTcpActivator )...Running
Status for World Wide Web Publishing Service ( W3SVC )...Running
Begin custom AfterDeploy target
Running 'Deployment' actions
Warming up web application urls
Hitting url from server SP15MEIPREV01: http://sp15meiprev01:25000...Done
Hitting url from server SP15MEIPREV01: http://my.sp15meiprev01.csi.local...Done
Hitting url from server SP15MEIPREV01: http://collaboration.sp15meiprev01.csi.local...Done
Hitting url from server SP15MEIPREV01: http://sp15meiprev01.csi.local...Done
Hitting url from server SP15MEIPREV01: http://search.sp15meiprev01.csi.local...Done
Warming up custom urls
Solution deployment finished
*******************************************************************************
* SPSD completed! *
* *
* Ended on : 08/08/2012 12:04:48 *
* Elapsed Time : 00:03:25.7247073 *
* Log file : .\Logs\Deploy-2012-08-08_12-01.log *
* Environment file : .\Environments\Environment-2012-08-08_12-01.xml *
*******************************************************************************
Sample XML input (for output above):
<SPSD Version="4.0.3.2932">
<!-- The Configuration node contains settings which may be reused in several environments -->
<!-- Attributes -->
<!-- Required: ID="[Configuration node ID]" Used to find corresponding referenced node in external file -->
<!-- FilePath="[filepath relative to this xml file]" Specify to replace the node with the same ID from the referenced file -->
<Configuration ID="Default">
<!-- The Settings node specifies global deployment settings for the powershell scripts -->
<Settings>
<!-- Number of milliseconds to wait between major deployments steps (default: 1000ms) -->
<DeploymentSleep>1000</DeploymentSleep>
<!-- Number of retries when solution deployment fails (default: 3) -->
<DeploymentRetries>3</DeploymentRetries>
<!-- Number of milliseconds to wait for processes, services (default: 60000ms) -->
<DeploymentTimeout>60000</DeploymentTimeout>
<!-- Specifies if checks and actions should be run on all servers in the farm or only the local server -->
<!-- ! Make sure that the deployment account is local administrator on all servers -->
<!-- ! Make sure that PowerShell Remoting is enabled on all servers and the deployment user is permitted-->
<!-- ! This can be done by running 'Enable-PSRemoting -Confirm:$false' -->
<IncludeAllServersInFarm>true</IncludeAllServersInFarm>
<!-- Number of milliseconds to leave the deployment script windows open after the deployment or "pause" to remain it open indefinetly (default: 10000ms)-->
<WaitAfterDeployment>10000</WaitAfterDeployment>
<!-- Use wizards to specify variables (not yet migrated from MSBuild to PowerShell) -->
<DisplayWizards>false</DisplayWizards>
<!-- Create a log file in ULS log format (not yet migrated from MSBuild to PowerShell) -->
<CreateULSLogfile>false</CreateULSLogfile>
</Settings>
<!-- The Restrictions node restricts the solution deployment process to certain requirements -->
<Restrictions>
<!-- Allow deployment of solution binaries to the global assembly cache (default: true) -->
<AllowGACDeployment>true</AllowGACDeployment>
<!-- Allow the deployment of binaries with code access security (CAS) policies (default: true)-->
<AllowCASPolicies>true</AllowCASPolicies>
<!-- Allow the deployment of binaries with full trust (default: true)-->
<AllowFullTrustBinDeployment>true</AllowFullTrustBinDeployment>
<!-- Minimal version number of the SharePoint installation required to deploy this solution (default: 14.0.0.0) -->
<MinimalSharePointVersion>14.0.0.0</MinimalSharePointVersion>
<!-- Minimal SharePoint license to deploy this solution. Valid values: Foundation (default), Standard, Enterprise -->
<MinimalSharePointLicense>Foundation</MinimalSharePointLicense>
</Restrictions>
<!-- The Actions node specifies actions which should run after the deployment, retraction or update process -->
<!-- Multiple 'Actions' nodes are possible in a configuration if different actions are reqired for different commands -->
<!-- All actions (excluding "WarmUpUrls") run before creating the environment site structures and the After* custom targets in CustomTargets.ps1 -->
<!-- Attributes -->
<!-- Optional: ForceAfterDeploy="[true|false]" Run actions after deployment (default: false) -->
<!-- Optional: AfterRetract="[true|false]" Run actions after deployment (default: false) -->
<!-- Optional: AfterUpdate="[true|false]" Run actions after update (default: false) -->
<Actions AfterDeploy="true" AfterRetract="true" AfterUpdate="true">
<!-- Restart SPTimerV4 Service on this/all servers with the Application role in the farm -->
<RestartService Name="SPTimerV4" Force="false" />
<!-- Restart SPAdminV4 Service on this/all servers in the farm -->
<RestartService Name="SPAdminV4" Force="false" />
<!-- Restart SPUserCodeV4 Service on this/all servers in the farm -->
<RestartService Name="SPUserCodeV4" Force="false" />
<!-- Perform IIS reset on this/all servers in the farm -->
<ResetIIS Force="false" />
<!-- Recycles all IIS application pools on this/all servers in the farm -->
<!-- Can be used alternatively to the ResetIIS action -->
<!-- Optional: All="[true|false]" All AppPools in IIS are restarted (not only the SharePoint WebApplication Pools) -->
<!--
<RecycleAppPools All="false" />
-->
<!-- Warms up urls after the deployment process -->
<!-- The warmup will be executed on this/all servers by using a local proxy to avoid issues with a load balancer -->
<!-- It is required, that the LoopBackCheck is disabled on this/all servers to run this action -->
<!-- The action will run after all structures are created and the custom deployment tasks are finished -->
<!-- The action is not executed on retraction -->
<!-- Optional: AllWebApps="[true|false]" Warms up all SharePoint WebApplications -->
<!-- Optional: AllSites="[true|false]" Warms up all SharePoint SiteCollections -->
<WarmUpUrls AllWebApps="true" AllSites="false">
<!-- You can also specify custom urls which should be hit
<WarmUp Url="$(SiteUrl)" />
<WarmUp Url="$(SiteUrl)" />
-->
</WarmUpUrls>
</Actions>
</Configuration>
<!-- The Environment node specifies the deployment enviroment with Variables, PreRequisiteSolutions, Solutions and SiteStructures -->
<!-- Attributes -->
<!-- Required: ID="[Environment node ID]" Used to find corresponding referenced node in external file -->
<!-- Optional: FilePath="[filepath relative to this xml file]" Specify to replace the node with the same ID from the referenced file -->
<Environment ID="Default">
<!-- The Variables node specifies the variables which will be replaced in the entire environment XML file -->
<!-- You can use variables with $(variablename) in the xml file and $vars["variablename"] in the DeploymentFunctions.ps1 PowerShell script -->
<!-- You can also use system environment variables with $(env:VARIABLENAME) in the xml file and $vars:VARIABLENAME in PowerShell -->
<!-- For a detailed list of ystem environment variables open cmd.exe and type "set"-->
<!-- Attributes -->
<!-- Required: ID="[Environment node ID]" Used to find corresponding referenced node in external file -->
<!-- Optional: FilePath="[filepath relative to this xml file]" Specify to replace the node with the same ID from the referenced file -->
<Variables ID="Default">
<Variable Name="UserID">$(env:USERDOMAIN)\$(env:USERNAME)</Variable>
<Variable Name="WebAppUrl">http://$(env:COMPUTERNAME).$(env:DNSDOMAIN)</Variable>
<Variable Name="SiteUrl">http://$(env:COMPUTERNAME).$(env:USERDNSDOMAIN)/sites/TestSite</Variable>
<Variable Name="LCID">1033</Variable>
</Variables>
<!-- The PreRequisiteSolutions node specifies which solution should be deployed -->
<!-- before the the deployment/update process is starting (does not apply to retraction)-->
<!-- Attributes -->
<!-- Required: ID="[PreRequisiteSolutions node ID]" Used to find corresponding referenced node in external file -->
<!-- Optional: FilePath="[filepath relative to this xml file]" Specify to replace the node with the same ID from the referenced file -->
<PreRequisiteSolutions ID="Default">
<!-- EXAMPLES: -->
<!-- Farm solution, which has to be deployed in the farm
<Solution Name="Solution.Name.wsp" /> -->
<!-- Farm solution, which has to be deployed to the web applications
<Solution Name="Solution.Name.wsp">
<WebApplication Url="$(WebAppUrl)" />
<WebApplication Url="$(WebAppUrl)" />
</Solution> -->
<!-- Sandboxed solution, which has to be deployed to the specified site collections
<Solution Name="Solution.Name.wsp">
<SiteCollection Url="$(SiteUrl1)" />
<SiteCollection Url="$(SiteUrl2)" />
<SiteCollection Url="$(SiteUrl3)" />
</Solution> -->
</PreRequisiteSolutions>
<!-- The solutionsSolutions node specifies which solution should be deployed/reatracted/updated -->
<!-- If the node is missing or empty all solution files found in the /Solutions folder -->
<!-- of the deployment package will be used as farm solutions on all content urls / globally -->
<!-- Attributes -->
<!-- Required: ID="[Solutions node ID]" Used to find corresponding referenced node in external file -->
<!-- Optional: FilePath="[filepath relative to this xml file]" Specify to replace the node with the same ID from the referenced file -->
<!-- Optional: Force="[true|false]" Set to force the deploy/retract/update command (can be used on Solutions/Solution nodes) -->
<!-- Optional: Overwrite="[true|false]" Set to overwrite solutions if they already exist, solution will be retracted before deployment (can be used on Solutions/Solution nodes)-->
<Solutions ID="Default" Force="true" Overwrite="true">
<Solution Name="TestSolutions.GAC.wsp" />
<Solution Name="TestSolutions.WebApplication.wsp" Force="true" Overwrite="true">
<WebApplication Url="http://collaboration.sp15meiprev01.csi.local" />
<WebApplication Url="$(WebAppUrl)" />
</Solution>
<Solution Name="TestSolutions.Sandboxed.wsp" Force="true" Overwrite="true">
<SiteCollection Url="http://collaboration.sp15meiprev01.csi.local" />
<SiteCollection Url="$(WebAppUrl)" />
</Solution>
<!-- If you specify one or more solutions here, only these will be used -->
<!-- The solution file has to be located in the '/Solutions' folder of the deployment package -->
<!-- Attributes are inherited from the solutions node and can be overridden for each solution -->
<!-- EXAMPLES: -->
<!-- Farm solution, which will be deployed to all web applications or globally
<Solution Name="Solution.Name.wsp" /> -->
<!-- Farm solution, which will be deployed only to the specified web applications
<Solution Name="Solution.Name.wsp" Force="true" Overwrite="true">
<WebApplication Url="$(WebAppUrl)" />
<WebApplication Url="$(WebAppUrl)" />
</Solution> -->
<!-- Sandboxed solution, which will be depoyed to the specified site collections
<Solution Name="Solution.Name.wsp" Force="true" Overwrite="true">
<SiteCollection Url="$(SiteUrl1)" />
<SiteCollection Url="$(SiteUrl2)" />
<SiteCollection Url="$(SiteUrl3)" />
</Solution> -->
</Solutions>
</Environment>
<!-- [Not yet implemented !] -->
<!-- The SiteStructures node defines one or multiple site structures which should be deployed or retracted (update command is not changing existing content)-->
<!-- Attributes -->
<!-- Required: ID="[SiteStructures node ID]" Used to find corresponding referenced node in external file -->
<!-- Optional: FilePath="[filepath relative to this xml file]" Specify to replace the node with the same ID from the referenced file -->
<!-- Optional: AllowRetraction="[true|false]" Specify the site structure should be removed retraction (Default: false) -->
<SiteStructures ID="Default" AllowRetraction="true"></SiteStructures>
</SPSD>
Environment Editor
Motivation
When managing multiple projects with multiple developers we are often facing the problem that too much time is wasted on setting up the right test environment and specifically setting up the test environment right.
You can find loads of basic PowerShell deployment scripts on the net, which do the basic tasks but nothing to serve all the needs we have in team development with multiple deployment machines and staging farms.
SPSD helps not only to have a standardized process to deploy and upgrade the solutions but also allows us to set up and rebuild the test environment on every machine the same way. In a next version it can also be used to deploy and build a test structure for integration or acceptance environment.
Acknowledgements
The new PowerShell version of SPSD is heavily inspired by AutoSPInstaller of Brian Lalancette. Pieces of code which we grabbed from the net are referenced directly in the scripts. If we missed someone, please drop me a line.