Questions tagged [dsc]

Desired State Configuration (DSC) is a feature in Windows Powershell that enables deployment and management of configuration data for software services and management of the environment in which these services run.

Description

DSC is a management platform in Windows PowerShell that enables deploying and managing configuration data for software services and managing the environment in which these services run.

DSC provides a set of Windows PowerShell language extensions, new Windows PowerShell cmdlets, and resources that you can use to declaratively specify how you want your software environment to be configured. It also provides a means to maintain and manage existing configurations.

Practical Applications

Following are some example scenarios where you can use built-in DSC resources to configure and manage a set of computers (also known as target nodes) in an automated way: Enabling or disabling server roles and features

  • Enabling or disabling server roles and features

  • Managing registry settings

  • Managing files and directories

  • Starting, stopping, and managing processes and services

  • Managing groups and user accounts

  • Deploying new software

  • Managing environment variables

  • Running Windows PowerShell scripts

  • Fixing a configuration that has drifted away from the desired state

  • Discovering the actual configuration state on a given node

In addition, you can create custom resources to configure the state of any application or system setting.

* Source: http://technet.microsoft.com/en-us/library/dn249912.aspx

Azure DSC

DSC has become a core configuration technology in Azure, Microsoft's cloud platform. A DSC can be associated with an Azure VM when it is created by setting a DSC configuration provision parameter. This ensures once the VM comes to a ready state, the vm is in the configuration required by the application.

There are three mechanisms by which Azure invokes DSC:

  • On VM creation if a DSC extension is set with Set-AzureVMDSCExtension cmdlet

  • On VM reboot: DSC is re-run during every VM reboot to assure the VM is in the "Desired State"

  • On VM update: if Set-AzureVMDSCExtension is executed on an existing VM, it will execute DSC.

Source: https://msdn.microsoft.com/en-us/library/azure/dn877980.aspx?f=255&MSPPError=-2147217396

AWS (Amazon Web Services) DSC

DSC has been extended to AWS, Amazon's cloud platform. A DSC can can be executed when an AWS VM is created with CloudFormation. This ensures once the VM comes to a ready state, the vm is in the configuration required by the application.

Source: https://s3.amazonaws.com/quickstart-reference/microsoft/powershelldsc/latest/doc/Windows_PowerShell_DSC_on_AWS.pdf

AWS DSC Toolkit

This module allows you to register AWS EC2 instances as DSC Nodes in Azure Automation. You can then control your EC2 instances in Azure Automation using PowerShell DSC configurations.

Source: https://github.com/PowerShell/AwsDscToolkit

Source: https://blogs.msdn.microsoft.com/powershell/2016/04/20/aws-dsc-toolkit/

510 questions
6
votes
2 answers

How to run a Powershell DSC script locally

I'm trying to run a very simple Powershell DSC script locally. (I never plan on pulling or pushing configuration files at this stage) I get the following error message. The WS-Management service is running, but there are no firewall holes or ports…
Kye
  • 5,919
  • 10
  • 49
  • 84
6
votes
5 answers

DSC - module does not exist at the PowerShell module path

This is the error I'm hitting: "The PowerShell provider does not exist at the PowerShell module path nor is it registered as a WMI provider" I'm not exactly a newbie to PowerShell and DSC, but I'm having a hard time figuring this one out. I…
Jason Capriotti
  • 1,836
  • 2
  • 17
  • 33
6
votes
0 answers

Import pfx certificate in CurrentUser Personal Store from DSC Script resource + Automation does not work

I am working on automating the deployment of our product on Azure VMs. I am using Powershell DSC with Azure automation to provision the VM. One of the requirement is to import a pfx certificate to CurrentUser/My for a user on the VM. I am trying to…
coder_andy
  • 376
  • 1
  • 3
  • 17
6
votes
3 answers

Start-DscConfiguration doesn't throw exceptions?

I noticed that if applying a configuration through Start-DscConfiguration fails, it writes to the error stream but doesn't throw an Exception? That is, if I do the following: try{ Start-DscConfiguration -Path ".\MyConfig" -Wait -Verbose }catch{ …
Leon Bouquiet
  • 4,159
  • 3
  • 25
  • 36
6
votes
1 answer

Error when applying PowerShell DSC configuration

I have a simple PowerShell DSC configuration block that ensures that a user account does not exist, and when I attempt to apply it to the local system using Start-DscConfiguration, I am receiving an error message similar to the following: The…
user189198
5
votes
1 answer

How to install and import module before call DSC in the same script?

I am trying to create a script which will prepare my web server. VM is Windows Server 2016 clean installation without any adjustments and imported modules and configurations. Inside the script, I have a mix of functions and DSC configuration for…
Branko
  • 831
  • 1
  • 8
  • 19
5
votes
2 answers

Azure PowerShell DSC install extra modules

As part of an Azure resource group template I have a PowerShell DSC extension setup for my VM which provisions various Windows features. As part of this automated setup I want to be able to open some ports in the firewall, after a bit of research I…
Mike Norgate
  • 2,393
  • 3
  • 24
  • 45
5
votes
1 answer

DSC File Resource File not copying PDB files

I am using the DSC File Resource to update the application server with the latest build. This works great except for .PDB files. These never get updated. I've reproduced this behavior with just a single file. Here is a sample…
5
votes
2 answers

Where does Powershell DSC find the module code?

I found an error in the Archive DSC module (MSFT_ArchiveResource.psm1). After copying the code, debugging it in the ISE and figuring out the two lines that needed to be fixed, I want to make the change to the real file and test using Puppet and the…
Paul Chernoch
  • 5,275
  • 3
  • 52
  • 73
5
votes
2 answers

Using the File provider in DSC - Ensure Destination only contains files from Source

I've created a DSC resource to copy a Modules directory from a certain source. I'm testing it for a broader deployment in my environment. The resource does a great job ensuring all the files are there and that they match the source content, so far…
Jason Morgan
  • 1,055
  • 7
  • 10
4
votes
2 answers

Error when running Start-DSCConfiguration: Could not load file or assembly 'System.Management.Automation', Version=7.1.0.0

When running Desired State Configuration command: Start-DSCConfiguration -ComputerName localhost -Path ./CsharpExample -Verbose -Wait -Force We get the following error: InvalidOperation: Importing module cSharpDSCResource failed with error - Could…
scranley
  • 188
  • 1
  • 4
  • 20
4
votes
3 answers

ARM template with DSC extension fails with security error after reboot during create new AD forest and domain

For months I have reliably used an ARM template that creates primary and backup domain controllers (based on 'active-directory-new-domain-ha-2-dc' in the quick start templates). On Friday it stopped working without any modifications being made. The…
Ed2001
  • 43
  • 3
4
votes
1 answer

Powershell DSC, Output MOF to different folder

Given this simple configuration file: Configuration MyDscConfiguration { Node "TEST-PC1" { WindowsFeature MyFeatureInstance { Ensure = "Present" Name = "RSAT" } WindowsFeature…
Brettski
  • 19,351
  • 15
  • 74
  • 97
4
votes
1 answer

Adding Inbound Rewrite Rule in DSC script does not work

As the title says I'm configuring Rewrite rules for Reverse Proxy functionality with: IIS 8.5 Windows Server 2012R2 URL Rewrite 2.1 Application Request Routing 3.0 Powershell 5.1 For this I'm using Powershell DSC, setting the configuration in a…
Devvox93
  • 166
  • 1
  • 3
  • 14
4
votes
2 answers

Credentials in Desired State Configuration

I have the following Desired State Configuration (DSC) Configuration Cert { param ( [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [System.String] $machineName, [Parameter(Mandatory = $true)] …
mynkow
  • 4,408
  • 4
  • 38
  • 65
1
2
3
33 34