Skip to content

Commit

Permalink
Move DSC docs from FeatureSamples
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyaiello committed Oct 16, 2015
1 parent 96808f9 commit 58e5ac0
Show file tree
Hide file tree
Showing 37 changed files with 5,582 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
log/
xhtml/
packages/
Binary file added dsc/DSC Starter Kit.docx
Binary file not shown.
68 changes: 68 additions & 0 deletions dsc/LCM.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
Outline:

* Get-DscLocalConfigurationManager
* Old style of configuring
* New style of configuring

# Windows PowerShell Desired State Configuration Local Configuration Manager

Local Configuration Manager is the Windows PowerShell Desired State Configuration (DSC) engine. It runs on all target nodes, and it is responsible for calling the configuration resources that are included in a DSC configuration script. This topic lists the properties of Local Configuration Manager and describes how you can modify the Local Configuration Manager settings on a target node.

## Local Configuration Manager properties
The following lists the Local Configuration Manager properties that you can set or retrieve.

* **AllowModuleOverwrite**: Controls whether new configurations downloaded from the configuration server are allowed to overwrite the old ones on the target node. Possible values are True and False.
* **CertificateID**: GUID a certificate used to secure credentials for access to the configuration. For more information see [Want to secure credentials in Windows PowerShell Desired State Configuration?](http://blogs.msdn.com/b/powershell/archive/2014/01/31/want-to-secure-credentials-in-windows-powershell-desired-state-configuration.aspx).
* **ConfigurationID**: Indicates a GUID which is used to get a particular configuration file from a server set up as a “pull” server. The GUID ensures that the correct configuration file is accessed.
* **ConfigurationMode**: Specifies how the Local Configuration Manager actually applies the configuration to the target nodes. It can take the following values:
- **ApplyOnly**: With this option, DSC applies the configuration and does nothing further unless a new configuration is detected, either by you sending a new configuration directly to the target node (“push”) or if you have configured a “pull” server and DSC discovers a new configuration when it checks with the “pull” server. If the target node’s configuration drifts, no action is taken.
- **ApplyAndMonitor**: With this option (which is the default), DSC applies any new configurations, whether sent by you directly to the target node or discovered on a “pull” server. Thereafter, if the configuration of the target node drifts from the configuration file, DSC reports the discrepancy in logs. For more about DSC logging, see [Using Event Logs to Diagnose Errors in Desired State Configuration](http://blogs.msdn.com/b/powershell/archive/2014/01/03/using-event-logs-to-diagnose-errors-in-desired-state-configuration.aspx).
- **ApplyAndAutoCorrect**: With this option, DSC applies any new configurations, whether sent by you directly to the target node or discovered on a “pull” server. Thereafter, if the configuration of the target node drifts from the configuration file, DSC reports the discrepancy in logs, and then attempts to adjust the target node configuration to bring in compliance with the configuration file.
* **ConfigurationModeFrequencyMins**: Represents the frequency (in minutes) at which the background application of DSC attempts to implement the current configuration on the target node. The default value is 15. This value can be set in conjunction with RefreshMode. When RefreshMode is set to PULL, the target node contacts the configuration server at an interval set by RefreshFrequencyMins and downloads the current configuration. Regardless of the RefreshMode value, at the interval set by ConfigurationModeFrequencyMins, the consistency engine applies the latest configuration that was downloaded to the target node. RefreshFrequencyMins should be set to an integer multiple of ConfigurationModeFrequencyMins.
* **Credential**: Indicates credentials (as with Get-Credential) required to access remote resources, such as to contact the configuration server.
* **DownloadManagerCustomData**: Represents an array that contains custom data specific to the download manager.
* **DownloadManagerName**: Indicates the name of the configuration and module download manager.
* **RebootNodeIfNeeded**: Certain configuration changes on a target node might require it to be restarted for the changes to be applied. With the value **True**, this property will restart the node as soon as the configuration has been completely applies, without further warning. If **False** (the default value), the configuration will be completed, but the node must be restarted manually for the changes to take effect.
* **RefreshFrequencyMins**: Used when you have set up a “pull” server. Represents the frequency (in minutes) at which the Local Configuration Manager contacts a “pull” server to download the current configuration. This value can be set in conjunction with ConfigurationModeFrequencyMins. When RefreshMode is set to PULL, the target node contacts the “pull” server at an interval set by RefreshFrequencyMins and downloads the current configuration. At the interval set by ConfigurationModeFrequencyMins, the consistency engine then applies the latest configuration that was downloaded to the target node. If RefreshFrequencyMins is not set to an integer multiple of ConfigurationModeFrequencyMins, the system will round it up. The default value is 30.
* **RefreshMode**: Possible values are **Push** (the default) and **Pull**. In the “push” configuration, you must place a configuration file on each target node, using any client computer. In the “pull” mode, you must set up a “pull” server for Local Configuration Manager to contact and access the configuration files.

### Example of updating Local Configuration Manager settings

You can update the Local Configuration Manager settings of a target node by including a **LocalConfigurationManager** block inside the node block in a configuration script, as shown in the following example.

```powershell
Configuration ExampleConfig
{
Node “Server001”
{
LocalConfigurationManager
{
ConfigurationID = "646e48cb-3082-4a12-9fd9-f71b9a562d4e"
ConfigurationModeFrequencyMins = 45
ConfigurationMode = "ApplyAndAutocorrect"
RefreshMode = "Pull"
RefreshFrequencyMins = 90
DownloadManagerName = "WebDownloadManager"
DownloadManagerCustomData = (@{ServerUrl="https://$PullServer/psdscpullserver.svc"})
CertificateID = "71AA68562316FE3F73536F1096B85D66289ED60E"
Credential = $cred
RebootNodeIfNeeded = $true
AllowModuleOverwrite = $false
}
# One or more resource blocks can be added here
}
}
# The following line invokes the configuration and creates a file called Server001.meta.mof at the specified path
ExampleConfig -OutputPath "c:\users\public\dsc"
```

Running the script in the previous example generates a MOF file that specifies and stores the desired settings. To apply the settings, you can use the **Set-DscLocalConfigurationManager** cmdlet, as shown in the following example.

```powershell
Set-DscLocalConfigurationManager -Path "c:\users\public\dsc"
```

**Note**: For the **Path** parameter, you must specify the same path that you specified for the **OutputPath** parameter when you invoked the configuration in the previous example.

To see the current Local Configuration Manager settings, you can use the **Get-DscLocalConfigurationManager** cmdlet. If you invoke this cmdlet with no parameters, by default it will get the Local Configuration Manager settings for the node on which you run it. To specify another node, use the **CimSession** parameter with this cmdlet.
27 changes: 27 additions & 0 deletions dsc/LCMConfig.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Configuring the Local Configuration Manager #
Applies To: Windows PowerShell 5.0
The Local Configuration Manager (LCM) is the engine of Windows PowerShell Desired State Configuration (DSC). The LCM runs on every target node, and is responsible for parsing and enacting configurations that are sent to the node. It is also responsible for a number of other aspects of DSC, including the following:

- Determining refresh mode (push or pull).
- Specifying how often a node pulls and enacts configurations.
- Associating the node with pull servers.
- Specifying partial configurations.
You use a special type of configuration to configure the LCM to specify each of these behaviors. The following sections describe how to configure the LCM.

**NOTE:** This topic applies to the LCM introduced in Windows PowerShell 5.0. For information about configuring the LCM in Windows PowerShell 4.0, see Windows PowerShell 4.0 Desired State Configuration Local Configuration Manager.
## Writing and enacting an LCM configuration ##
To configure the LCM, you create and run a special type of configuration. To specify an LCM configuration, you use the **DscLocalConfigurationManager** attribute. The following shows a simple configuration that sets the LCM to push mode.
```powershell
[DSCLocalConfigurationManager()]
configuration LCMConfig
{
Node localhost
{
Settings
{
RefreshMode = 'Push'
}
}
}
```

15 changes: 15 additions & 0 deletions dsc/TOC.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# [Overview](overview.md)

# [Configurations](configurations.md)
## [Authoring configurations](configuration_authoring.md)
## [Configuration data](configData.md)

# Resources
## [Authoring custom resources](authoringResource.md)
### [MOF-based](authoringResourceMOF.md)
### [Class-based](authoringResourceClass.md)
### [Composite resource](authoringResourceComposite.md)

# [MetaConfiguration (LCM)](LCM.md)

# [DSC Pull Server](pullServer.md)
48 changes: 48 additions & 0 deletions dsc/archiveResource.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#DSC Archive Resource#

>Applies To: Windows PowerShell 4.0, Windows PowerShell 5.0
The Archive resource in Windows PowerShell Desired State Configuration (DSC) provides a mechanism to unpack archive (.zip) files at a specific path.

##Syntax##
```MOF
Archive [string] #ResourceName
{
Destination = [string]
Path = [string]
[ Checksum = [string] { CreatedDate | ModifiedDate | SHA-1 | SHA-256 | SHA-512 } ]
[ DependsOn = [string[]] ]
[ Ensure = [string] { Absent | Present } ]
[Force = [bool] ]
[ Validate = [bool] ]
}
```

##Properties##






| Property | Description |
|---|---|
| Destination| Specifies the location where you want to ensure the archive contents are extracted.|
| Path| Specifies the source path of the archive file.|
| __Checksum__| Defines the type to use when determining whether two files are the same. If __Checksum__ is not specified, only the file or directory name is used for comparison. Valid values include: SHA-1, SHA-256, SHA-512, createdDate, modifiedDate, none (default). If you specify __Checksum__ without __Validate__, the configuration will fail.|
| Ensure| Determines whether to check if the content of the archive exists at the __Destination__. Set this property to __Present__ to ensure the contents exist. Set it to __Absent__ to ensure they do not exist. The default value is __Present__.|
| DependsOn | Indicates that the configuration of another resource must run before this resource is configured. For example, if the ID of the resource configuration script block that you want to run first is ResourceName and its type is __ResourceType__, the syntax for using this property is `DependsOn = "[ResourceType]ResourceName"`.|
| Validate| Uses the Checksum property to determine if the archive matches the signature. If you specify Checksum without Validate, the configuration will fail. If you specify Validate without Checksum, a SHA-256 checksum is used by default.|
| Force| Certain file operations (such as overwriting a file or deleting a directory that is not empty) will result in an error. Using the Force property overrides such errors. The default value is False.|

##Example##

The following example shows how to use the Archive resource to ensure that the contents of an archive file called Test.zip exist and are extracted at a given destination.
```
Archive ArchiveExample {
Ensure = "Present" # You can also set Ensure to "Absent"
Path = "C:\Users\Public\Documents\Test.zip"
Destination = "C:\Users\Public\Documents\ExtractionPath"
}
```

13 changes: 13 additions & 0 deletions dsc/authoringResource.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Build Custom Windows PowerShell Desired State Configuration Resources

Windows PowerShell Desired State Configuration (DSC) has built-in resources that you can use to configure your environment. (For more information, see [Built-In Windows PowerShell Desired State Configuration Resources](TODO).) This topic provides an overview of developing resources and links to topics with specific information and examples.

## DSC resource components

A DSC resource is a Windows PowerShell module. The module contains both the schema (the definition of the configurable properties) and the implementation (the code that does the actual work specified by a configuration) for the resource. A DSC resource schema can be defined in a MOF file, and the implementation is performed by a script module. Beginning with the support of PowerShell classes in version 5, the schema and implementation can both be defined in a class. The following topics describe in more detail how to create DSC resources.

* [Writing a custom DSC resource with MOF](TODO)
* [Implementing a DSC resource in C#](TODO)
* [Writing a custom DSC resource with PowerShell classes](TODO)
* [Composite resources: Using a DSC configuration as a resource](TODO)
* [Using the Resource Designer tool](TODO)
Loading

0 comments on commit 58e5ac0

Please sign in to comment.