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, staging and production environment.

I added the source code to GitHub. I do not store the entire module there. I decided to use a script (New-xSharePointAdministration.ps1) that uses the xDscResourceDesigne-Module to create the resource. I think this is easier, if you want to work in a repository and with test data. I created a resource for every possible scenario that I could thinks of: passing properties to the corresponding CmdLet from SharePoint (like xSite), working with server objects (like SPWeb in xList) and working with a complex mix of various PowerShell SharePoint CmdLets (like xFarmSolution). So it should be really easy to add more resources for other people. If you want to add your own resource and have problems getting everything up and running, please contact me and I will try to help.

The module currently contains the following resources:

Resource Description
xSite A resource to ensure, that a site collection (SPSite) is present or absent at a given URL.
xWeb A resource to ensure, that a web site (SPWeb) is present or absent at a given URL.
xList A resource to ensure, that a list (SPList) is present or absent at a given URL.

Note: Up to now the resource does not support the configuration of the list, it content types or fields. This will come in future versions.

xFarmSolution A resource to deploy a farm solution to a farm or web application. The farm solution contains a version number that is stored in the property bag of the solution to ensure a specific version.
xFeature A resource to ensure that a feature is enabled or disabled at a given scope.

You can find a detailed description in the description section of the description section of the script center.

Please let me know, what the most important resources are for you for future releases.

12 thoughts on “xSharePointAdministration Module – PowerShell Desired State Configuration (DSC)

  1. Hi Mike, We are trying to create list using ALIS_xlist, but we always get error (Exception calling “Add” with “3” argument(s): “Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))” it is failing at the line $web.Lists.Add($ListName,$Description,$TemplateID) . Can you please let me know what and where I am going wrong

    1. Under which account runs your winmgm service? If it is “Local System” you have to create a policy in the web application that allows the System account full access to all sites. You also have to make local system a SPShellAdmin. For provisioning lists and items you can also use xSharePointProvisioning (https://github.com/wulfland/xSharePointProvisioning) DSC module. This module uses CSOM instead of SharePoint PowerShell.

      1. Mike, winmgmt service is run using Local System account. We tried to create a policy and give full access to System Account and made System Account as SPShellAdmin , but still we are facing the Access Denied issue.

        Workaround we did was we added “Everyone” as “Site Collection Administrator” and we could get the list created.

        Please let me know if there are any other way to get this working other than adding Everyone as site collection administrator, Also I am trying to create list items for list using the xListItem resource, but I can add only one item. Is it how it is supposed to or am I missing anything.


      2. I’m sorry that you’re having problems getting it to work. I will write a short post on SPAdministration and security today and add some screenshots how I set up my farms with the resource.
        The issue with xListItem is from the module xSharePointProvisioning right? Do you pass in credentials or do you use it without credentials? (The credentials are currently set up for O365 and you would have to change this for on premise). I’m also writing on a post for that module – but I can’t promise that I’ll get it done toda. I’ll try.

      3. As I pointed out in my new post – I can reproduce the error on a farm here. I’m trying somethings – but I had no luck so far. I let you know, if I figure out something. Please use xSharePointProvisioning for xWeb and XList in the meantime. I’ll create a branch and change the credentials to NetWorkCredentials so that you can use an explicit account.

  2. Thanks Mike, I got xListItems working. I have removed credentials part from xSharePointProvisioning, it is still working may be because of Everyone group in Administrator. I am able to add more than 1 list item.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s