PowerShell DSC for SharePoint

I stopped the work on my DSC modules for SharePoint (xSharePointAdministration) some time ago because the PowerShell team was working on the xSharePoint module. The module has now reached Version 1.0 and was renamed to SharePointDSC. The module is already pretty mayor and can be used to deploy SharePoint 2013 and SharePoint 2016. It supports PowerShell 4.0 and 5.0. I already started using it in some customer projects. It’s not yet perfect – but what the PowerShell team does is really “Open Development” and not just “Open source”. I contributed the xSPFarmSolution resource, the version parameter for the xFeature resource … Continue reading PowerShell DSC for SharePoint

Don’t forget the NodeName in your DSC ConfigurationData

Today I created a new configuration data for a DSC configuration and got the following error: all elements of AllNodes need to be hashtable and has a property ‘NodeName’. The config looked good: AllNodes was a hashtable and it had the desired node name. So where was the error? I forgot one little thing: the global configuration needs a property NodeName set to an asterisk. Adding this fixed the error. This is really easy – but a search for the error message did not return any useful results. Therefor I decided to share it anyway… Continue reading Don’t forget the NodeName in your DSC ConfigurationData

Be careful with custom variable names in Release Management

If you use Visual Studio Release Management vNext / 2013 with PowerShell/DSC you probably have a lot of custom configuration variables that you pass to your scripts. Be careful when you choose the names for these variables because! There are a lot of reserved words. For example the word UserName is reserved. This leads to very odd error messages that are really hard to track down: System.AggregateException: One or more errors occurred. —> Microsoft.TeamFoundation.Release.Common.Helpers.OperationFailedException: Permission denied while trying to connect to the target machine <hostname> on the port:5985 via power shell remoting. Please check the following link for instructions: http://go.microsoft.com/fwlink/?LinkID=390236System.Management.Automation.Remoting.PSRemotingTransportException: … Continue reading Be careful with custom variable names in Release Management

xSharePointProvisioning Module – PowerShell Desired State Configuration (DSC)

The xSharePointProvisioning module contains DSC resources to provision SharePoint artifacts using the Client Side Object Model (CSOM). There are two versions: one for O365 and ne for SharePoint on premise. Currently the following resources are in the package: xList Ensure a list with a specific title and description at a given URL. If the list does not exist it will be created with the specified template. xField Ensure that a list at a specific url has or has not a specified field. XListItem Ensure that a list at a specific url has or has not a list item with the … Continue reading xSharePointProvisioning Module – PowerShell Desired State Configuration (DSC)

Use the DSC Script resource to change the application pool identity

The Desired State Configuration (DSC) module xWebAdministration does not yet support changing the identity of an application pool. There is a community fork cWebAdministration that seems to support it –  but I have not tested it yet. What I did was to use the script resource to change the identity using the module WebAdministration. This is pretty straight forward so I just share the code here. Note that after changing the identity the state of the application pool is stopped. You can use the xWebAppPool resource to start it again. Continue reading Use the DSC Script resource to change the application pool identity

Configuring your SharePoint farm for DSC with xSharePointAdministration

Getting the xSharePointAdministration module to work has a lot of gotchas. So I decided to write a separate post for it. First of all: the xSharePointAdministration module uses the PSSnapin “Microsoft.SharePoint.PowerShell” for all its work. It therefore must be run on only one server in the farm – this would normally be the server that hosts the central administration. I will refer to this server as the deployment server. Make sure to do all the work on the deployment server. Desired state configurations are run by the Windows Management Instrumentation (winmgmt) service. This service normally runs under the “Local System” … Continue reading Configuring your SharePoint farm for DSC with xSharePointAdministration

Moving from PowerShell DSC to Release Management vNext DSC

If you’ve learned plain PowerShell Desired State Configuration (DSC) and then move to Visual Studio Release Management vNext there are a lot of gotchas that can cost you many hours or event days to figure them out. I thought I share some things I’ve learned the hard way to get people up and running more quickly. If you use plain DSC you normally have one structural configuration for the entire environment and an environment specific configuration that you change for each environment. Environment Configuration(Dev/Test/Prod) $TargetFolder = “C:\inetpub\wwwroot\Demo”$WebServerCount = 2 .psd1 Structural Configuration WindowsFeature IIS{    Name = “Web Server”    Ensure = … Continue reading Moving from PowerShell DSC to Release Management vNext DSC

Packaging DSC configurations for Visual Studio / TFS Release Management vNext

If you are using Visual Studio Release Management vNext to release your applications you’ll probably have DSC (Desired State Configuration) configurations that are shared between applications or provided by your operations team. In both cases they have a different lifecycle than your application and should be provisioned individually. But how do you publish PowerShell scripts or other files with the TFS build engine without creating empty solutions and adding the files? What you can do is to add a simple project file like TFSBuild.proj that calls a PowerShell script. This project file can be used in a team build. The … Continue reading Packaging DSC configurations for Visual Studio / TFS Release Management vNext

xSharePointAdministration Module – PowerShell Desired State Configuration (DSC)

Today I added the first version of the PowerShell Desired State Configuration (DSC) Module xSharePointAdministration to the Script Center. The module contains resources to configure and deploy SharePoint environments. The current version has only limited resources. I will add more resources in the near future since I have some projects that will build upon the module. The goal is to provision a complete SharePoint farm using DSC so that you can easily deploy it to different environments – either in the cloud or on premise – and avoid the configuration shift that normally takes place after some time between test, … Continue reading xSharePointAdministration Module – PowerShell Desired State Configuration (DSC)