Average time to read: 4 minutes

Desired State Configuration (DSC)โ€ฆ Ring any bells? No? It should by now. Although it isnโ€™t a technology or concept thought up by Citrix, it is still very much applicable to Citrix components and infrastructures. DCS is a (still relatively) new management platform for Windows PowerShell allowing you to configure, apply and maintain a certain desired state (duh) on a single or multiple machine(s). A desired state can be anything related to software installation and configuration, the management of files and folders, registry entries, local group and account management, adding and removing server roles and the list goes on. Best thing is, as soon as something changes DSC will step in and correct it for you, preserving the desired state. DSC is a PowerShell extension and ships with Windows Server 2012 R2 and Windows 8.1. Letโ€™s have a closer look at what is needed.

Simple, but skills are needed

Although the idea behind DSC is relatively straightforward, you do need to have some specific PowerShell skills to get things going. Initially you will use PowerShell to write a configuration script which, when executed, will generate a so-called MOF file. This file will hold the actual desired state configuration. MOF stand for Managed Object Format. What happens is, when executing the PS script the configuration (desired state) will be build, or written, in memory before being compiled into a MOF file. This is called the authoring phase.

Due note that MOF files can be created in other ways as well, third party tooling or other languages are also available. For example, a simple text editor can also be used. PowerShell v4 just makes it easier by adding declarative syntax extensions and IntelliSense. An end to a means, so to speak.

The MOF file is what will eventually be deployed, or pushed out, to the actual machine(s), applying the desired state. Once a machine has its desired state applied, you can re-apply your configuration as many times over as you feel fit, ensuring (monitoring) that the machine, or machines, will continue to keep their desired state. This is referred to as the deployment phase.

When a configuration is being re-applied it will only change the settings that do not match the desired state in the MOF file, everything else will simply get skipped. If you are already familiar with PowerShell this will probably be an easy step to take, getting started with DSC I mean. If not, then it might take some time to get your head around this. But when you do, you will have another Powerful automation tool at your disposal, free and very flexible. No agents needed and you can use it on-permissies as well as in your cloud deployments, supporting multiple frameworks.

You wonโ€™t have to start from scratch

Of course youโ€™ll get some help, DCS works with so called recourse providers (modules), which contain the necessary resources to help build your PowerShell configuration script(s).

To start, there are twelve (build-in) resource providers offered by Microsoft, more information can be found in the TechNet Script center. These providers enable you to configure roles and features, copy files, create registry entries, manage services, create local users and groups, etc. And if that isnโ€™t enough there are a few extra sets of DSC resource kits available (these are referred to as waves) extending your modules and configuration resources toolbox even further.

Custom resource providers

You also have the option to build your own custom PowerShell Desired Sate configuration resources. For this you will need to have, at least, a basic understanding on how to create PowerShell functions, basic Windows PowerShell providers and how to work with DSC providers in configuration scripts in general. If you would like to know more, check this page.

Not that long ago Citrix released their own custom resource provider, they named it, the XenDesktop Desired State Configuration resource provider Tech Preview. You can read all about it here. Although it may not sound very sexy and it isnโ€™t a hot topic at this time it is definitely something to keep an eye on and perhaps worth investing some time in, to see what I might do for you. Iโ€™m pretty sure that we will see and hear a lot more on this in the months / years to come.

What you will need

PowerShell 4.0, or the Windows Management Framework 4.0, is needed to be able to utilize DSC. By default PS / WMF 4.0 are part of Windows Server 2012 R2 and Windows 8.1. Windows 7 and Windows Server 2008R2 are also supported but additional installation steps will be needed.

WMF and/or PS 4.0 canโ€™t be installed in Windows 8.

You will need to be a local Administrator and WMF / PS 4.0 must be installed on all machines involved in the process. So the machine on which you create / compile the configuration script / MOF file as well as the machines to which the desired state gets applied.

The process.

In theory it works like this:

  1. Create a PowerShell configuration script, defining the desired state.
  2. Execute the configuration file.
  3. MOF file gets generated. It will contain what to install, which roles, how to configure, pre-checks etcโ€ฆ
  4. The MOF file gets deployed to one or multiple machines. This can be done in two ways, using the push or pull method.
  5. The push method (most used) uses the Start-DscConfiguration CMDlet to push out the MOF file to the target node(s).
  6. Using the pull method we would need to setup an http or https web server or a SMB file server for pull purposes.

Desired State Configuration

Wrap up

Although I havenโ€™t showed you how to actually use and apply DSC, I still hope this article helped you in understanding its capabilities, what is needed to get started and which steps are involved to get from a to b. I donโ€™t think it will be too hard to come up with a valid use case.

Part of the -1000 blog series.

Bas van Kaam on FacebookBas van Kaam on LinkedinBas van Kaam on Twitter
Bas van Kaam
Bas van Kaam
Field CTO EMEA by day, author by night @ Nerdio
Father of three, EMEA Field CTO @ Nerdio, Author of the book Van de Basis tot aan Meester in de Cloud, Co-author of the book Project Byte-Sized and Yuthor of the book: Inside Citrix โ€“ The FlexCast Management Architecture, over 500 blog posts and multiple (ultimate) cheat sheets/e-books. Public speaker, sport enthusiastยญยญยญยญยญยญยญยญ: above-average runner, 3 x burpee-mile finisher and a former semiprofessional snooker player. IT community participant and initiator of the AVD User group Community world wide.
, , , ,


One response to “Desired State Configuration & the Citrix XenDesktop DSC Tech Preview”

  1. […] 8 de abril de 2015 / nunoqueirosalves Desired State Configuration (DSC)โ€ฆ Ring any bells? No? It should by now. Although it isnโ€™t a technology or concept thought up by Citrix, it is still very much applicable to Citrix components and infrastructures. DCS is a (still relatively) new management platform for Windows PowerShell allowing you to configure, apply and maintain a certain desired state (duh) on a single or multiple machine(s). A desired state can be anything related to software installation and configuration, the management of files and folders, registry entries, local group and account management, adding and removing server roles and the list goes on. Best thing is, as soon as something changes DSC will step in and correct it for you, preserving the desired state. DSC is a PowerShell extension and ships with Windows Server 2012 R2 and Windows 8.1. Letโ€™s have a closer look at what is needed. Continueย reading… https://www.basvankaam.com/2015/04/07/desired-state-configuration-the-citrix-xendesktop-dsc-tech-prev… […]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

About

Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown prmontserrat took a galley of type and scrambled it to make a type specimen book.

Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown prmontserrat took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

Categories

Gallery

Verified by MonsterInsights