Skip to content

Commit

Permalink
visual test path, fixed broken tables and lists, added missing links,…
Browse files Browse the repository at this point in the history
… added TOC topics, added back pull client config ID topic
  • Loading branch information
eslesar committed Nov 3, 2015
1 parent ed83712 commit db670ed
Show file tree
Hide file tree
Showing 15 changed files with 145 additions and 17 deletions.
23 changes: 23 additions & 0 deletions dsc/TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@

## [Resources](resources.md)
### [Built-in resources](builtInResource.md)
#### [Archive Resource](archiveResource.md)
#### [Environment Resource](environmentResource.md)
#### [File Resource](fileResource.md)
#### [Group Resource](groupResource.md)
#### [Log Resource](logResource.md)
#### [Package Resource](packageResource.md)
#### [Registry Resource](registryResource.md)
#### [Script Resource](scriptResource.md)
#### [Service Resource](serviceResource.md)
#### [User Resource](userResource.md)
#### [Windows Feature Resource](windowsfeatureResource.md)
#### [WindowsProcess Resource](windowsProcessResource.md)
### [Authoring custom resources](authoringResource.md)
#### [MOF-based custom resources](authoringResourceMOF.md)
##### [MOF-based resource in C#](authoringResourceMofCS.md)
Expand All @@ -20,10 +32,21 @@
### [Setting up a web pull server](pullServer.md)
### [Setting up an SMB pull server](pullServerSMB.md)
### [Setting up a pull client](pullClient.md)
#### [Setting up a pull client using configuration names](pullClientConfigNames.md)
#### [Setting up a pull client using configuration ID](pullClientConfigID)
### [Pull server best practices](secureServer.md)

## [Troubleshooting DSC](troubleshooting.md)

## DSC on Linux
### [Getting started with DSC for Linux](LinuxGettingStarted.md)
### [Built-in resorces for Linux](lnxBuiltInResources.md)
#### [nxArchive Resource](lnxArchiveResource.md)
#### [nxEnvironment Resource](lnxEnvironmentResource.md)
#### [nxFile Resource](lnxFileResource.md)
#### [nxFileLine Resource](lnxFileLineResource.md)
#### [nxGroup Resource](lnxGroupResource.md)
#### [nxPackage Resource](lnxPackageResource.md)
#### [nxService Resource](lnxServiceResource.md)
#### [nxSshAuthorizedKeys Resource](lnxSshAuthorizedKeysResource.md)
#### [nxUser Resource](lnxUserResource.md)
1 change: 1 addition & 0 deletions dsc/archiveResource.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Archive [string] #ResourceName
## 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"
Expand Down
2 changes: 1 addition & 1 deletion dsc/authoringResourceClass.md
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ PowerShellVersion = '5.0'

## Test the resource

After saving the class and manifest files in the folder structure as described earlier, you can create a configuration that uses the new resource. For information about how to run a DSC configuration, see [Get Started with Windows PowerShell Desired State Configuration](overview.md). The following configuration will check to see whether the file at `c:\test\test.txt` exists, and, if not, copies the file from `c:\test.txt` (you should create `c:\test.txt` before you run the configuration).
After saving the class and manifest files in the folder structure as described earlier, you can create a configuration that uses the new resource. For information about how to run a DSC configuration, see [Enacting configurations](enactingConfigurations.md). The following configuration will check to see whether the file at `c:\test\test.txt` exists, and, if not, copies the file from `c:\test.txt` (you should create `c:\test.txt` before you run the configuration).

```powershell
Configuration Test
Expand Down
2 changes: 1 addition & 1 deletion dsc/authoringResourceMOF.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Note the following about the previous code:

The resource script implements the logic of the resource. In this module, you must include three functions called **Get-TargetResource**, **Set-TargetResource**, and **Test-TargetResource**. All three functions must take a parameter set that is identical to the set of properties defined in the MOF schema that you created for your resource. In this document, this set of properties is referred to as the “resource properties.” Store these three functions in a file called <ResourceName>.psm1. In the following example, the functions are stored in a file called Demo_IISWebsite.psm1.

**Note**: When you run the same configuration script on your resource more than once, you should receive no errors and the resource should remain in the same state as running the script once. To accomplish this, ensure that your **Get-TargetResource** and **Test-TargetResource** functions leave the resource unchanged, and that invoking the **Set-TargetResource** function more than once in a sequence with the same parameter values is always equivalent to invoking it once.
>**Note**: When you run the same configuration script on your resource more than once, you should receive no errors and the resource should remain in the same state as running the script once. To accomplish this, ensure that your **Get-TargetResource** and **Test-TargetResource** functions leave the resource unchanged, and that invoking the **Set-TargetResource** function more than once in a sequence with the same parameter values is always equivalent to invoking it once.
In the **Get-TargetResource** function implementation, use the key resource property values that are provided as parameters to check the status of the specified resource instance. This function must return a hash table that lists all the resource properties as keys and the actual values of these properties as the corresponding values. The following code provides an example.

Expand Down
3 changes: 2 additions & 1 deletion dsc/builtInResource.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ Windows PowerShell Desired State Configuration (DSC) comes with a set of built-i
- [Script Resource](scriptResource.md)
- [Service Resource](serviceResource.md)
- [User Resource](userResource.md)
- [Windows Feature Resource](windowsFeatureResource.md)
- [Windows Feature Resource](windowsfeatureResource.md)
- [WindowsProcess Resource](windowsProcessResource.md)
2 changes: 1 addition & 1 deletion dsc/configData.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,4 @@ configuration MyConfiguration
}
```

You can find a full example included in the [xWebAdministration module](https://powershellgallery.com/packages/xWebAdministration)
You can find a full example included in the [xWebAdministration module](https://powershellgallery.com/packages/xWebAdministration).
1 change: 1 addition & 0 deletions dsc/enactingConfigurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ In pull mode, pull clients are configured to get their desired state configurati
Each one of the pull clients has a scheduled task that performs a periodic compliance check on the configuration of the node. When the event is triggered the first time, it causes the Local Configuration Manager (LCM) on the pull client to validate the configuration. If the pull client is configured as desired, nothing happens. Otherwise, the LCM makes a request to the pull server to get a given configuration. If that configuration exists on the pull server, and it passes initial validation checks, the configuration is transmitted to the pull client, where it is then executed by the LCM.

The following topics explain how to set up pull servers and clients:

- [Setting up a web pull server](pullServer.md)
- [Setting up an SMB pull server](pullServerSMB.md)
- [Configuring a pull client](pullClientConfigID.md)
1 change: 1 addition & 0 deletions dsc/environmentResource.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Environment [string] #ResourceName
## Example

The following example ensures that __TestEnvironmentVariable__ is present and it has the value __TestValue__. If it is not present, it creates it.

```powershell
Environment EnvironmentExample
{
Expand Down
1 change: 1 addition & 0 deletions dsc/groupResource.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Group [string] #ResourceName
## Example

The following example shows how to ensure that a group called TestGroup is absent.

```powershell
Group GroupExample
{
Expand Down
1 change: 1 addition & 0 deletions dsc/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Following are some example scenarios where you can use built-in DSC resources to

## Key Concepts
DSC is a declarative platform used for configuration, deployment, and management of systems. It consists of three primary components:

* [Configurations](configurations.md) are declarative PowerShell scripts which define and configure instances of resources. Upon running the configuration, DSC (and the resources being called by the configuration) will simply “make it so”, ensuring that the system exists in the state laid out by the configuration. DSC configurations are also idempotent: the Local Configuration Manager (LCM) will continue to ensure that machines are configured in whatever state the configuration declares.
* Resources are the imperative building blocks of DSC which are written to model the various components of a sub-system and implement the control flow of their changing states. They reside within PowerShell modules and can be written to model something as generic as a file or a Windows process or as specific as an IIS server or a VM running in Azure.
* The Local Configuration Manager (LCM) is the engine by which DSC facilitates the interaction between resources and configurations. The LCM regularly polls the system using the control flow implemented by resources to ensure that the state laid out by a Configuration is maintained. If the system is out of state, the LCM uses more logic inside of the resources to “make it so” according to the Configuration declaration.
Expand Down
1 change: 1 addition & 0 deletions dsc/pullClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
>Applies To: Windows PowerShell 4.0, Windows PowerShell 5.0
Each target node has to be told to use pull mode and given the URL where it can contact the pull server to get configurations. The following topics explain how to set up pull clients.

+ [Setting up a pull client using configuration names](pullClientConfigNames.md)
+ [Setting up a pull client using configuration ID](pullClientConfigID.md)

Expand Down
107 changes: 107 additions & 0 deletions dsc/pullClientConfigID.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Setting up a pull client using configuration ID

>Applies To: Windows PowerShell 5.0
Each target node has to be told to use pull mode and given the URL where it can contact the pull server to get configurations. To do this, you have to configure the Local Configuration Manager (LCM) with the necessary information. To configure the LCM, you create a special type of configuration, derated with the **DSCLocalConfigurationManager** attribute. For more information about configuring the LCM, see [Configuring the Local Configuration Manager](metaConfig.md).

>**Note**: This topic applies to PowerShell 5.0. For information on setting up a pull client in PowerShell 4.0, see [Setting up a pull client using configuration ID in PowerShell 4.0](pullClientConfigID4.md)
The following script configures the LCM to pull configurations from a server named "CONTOSO-PullSrv".

```powershell
[DSCLocalConfigurationManager()]
configuration PullClientConfigID
{
Node localhost
{
Settings
{
RefreshMode = 'Pull'
ConfigurationID = 1d545e3b-60c3-47a0-bf65-5afc05182fd0'
RefreshFrequencyMins = 30
RebootNodeIfNeeded = $true
}
ConfigurationRepositoryWeb CONTOSO-PullSrv
{
ServerURL = 'https://CONTOSO-PullSrv:8080/PSDSCPullServer.svc'
}
}
}
PullClientConfigID
```

In the script, the **ConfigurationRepositoryWeb** block defines the pull server. The **ServerURL**

After this script runs, it creates a new output folder named **PullClientConfigID** and puts a metaconfiguration MOF file there. In this case, the metaconfiguration MOF file will be named `localhost.meta.mof`.

To apply the configuration, call the **Set-DscLocalConfigurationManager** cmdlet, with the **Path** set to the location of the metaconfiguration MOF file. For example: `Set-DSCLocalConfigurationManager localhost –Path .\PullClientConfigID –Verbose.`

## Configuration ID
The script sets the __ConfigurationID__ property of LCM to a GUID that had been previously created for this purpose (you can create a GUID by using the __New-Guid__ cmdlet). The __ConfigurationID__ is what the LCM uses to find the appropriate configuration on the pull server. The configuration MOF file on the pull server must be named _ConfigurationID_.mof, where _ConfigurationID_ is the value of the __ConfigurationID__ property of the target node's LCM.

## SMB pull server
To set up a client to pull configurations from an SMB server, use a **ConfigurationRepositoryShare** block. In a **ConfigurationRepositoryShare** block, you specify the path to the server by setting the **SourcePath** property. The following metaconfiguration configures the target node to pull from an SMB pull server named **SMBPullServer**.

```powershell
[DSCLocalConfigurationManager()]
configuration PullClientConfigID
{
Node localhost
{
Settings
{
RefreshMode = 'Pull'
ConfigurationID = '1d545e3b-60c3-47a0-bf65-5afc05182fd0'
RefreshFrequencyMins = 30
RebootNodeIfNeeded = $true
}
ConfigurationRepositoryWeb SMBPullServer
{
SourcePath = '\\SMBPullServer\PullSource'
}
}
}
PullClientConfigID
```

## Resource and report servers
By default, the client node gets required resources from and reports status to the configuration pull server. However, you can specify different pull servers for resources and reporting.
To specify a resource server, you use either a **ResourceRepositoryWeb** (for a web pull server) or a **ResourceRepositoryShare** block (for an SMB pull server).
To specify a report server, you use a **ReportRepositoryWeb** block. A report server cannot be an SMB server.
The following metaconfiguration configures a pull client to get its configurations from **CONTOSO-PullSrv** and its resources from **CONTOSO-ResourceSrv**, and to send status reports to **CONTOSO-ReportSrv**.
[DSCLocalConfigurationManager()]
configuration PullClientConfigID
{
Node localhost
{
Settings
{
RefreshMode = 'Pull'
ConfigurationID = '1d545e3b-60c3-47a0-bf65-5afc05182fd0'
RefreshFrequencyMins = 30
RebootNodeIfNeeded = $true
}

ConfigurationRepositoryWeb CONTOSO-PullSrv
{
ServerURL = 'https://CONTOSO-PullSrv:8080/PSDSCPullServer.svc'
}
ResourceRepositoryWeb CONTOSO-ResourceSrv
{
ServerURL = 'https://CONTOSO-REsourceSrv:8080/PSDSCPullServer.svc'
}

ReportServerWeb CONTOSO-ReportSrv
{
ServerURL = 'https://CONTOSO-REsourceSrv:8080/PSDSCPullServer.svc'
}
}
}
PullClientConfigID

## See Also
[Setting up a pull client with configuration names](pullClientConfigNames.md)
1 change: 1 addition & 0 deletions dsc/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
A Desired State Configuration (DSC) resource can model something as generic as a file or a Windows process or as specific as an IIS server or a VM running in Azure. Resources provide the building blocks for a DSC configuration. A resource exposes properties that can be configured (schema) and contains the PowerShell code that the Local Configuration Manager (LCM) calls to "make it so."

The following topics describe DSC resources:

- [Built-In DSC resources](builtInResource.md)
- [Build custom DSC resources](authoringResource.md)
- [Built-In DSC resources for Linux](lnxBuiltInResources.md)
15 changes: 3 additions & 12 deletions dsc/serviceResource.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,14 @@ Service [string] #ResourceName
| Property | Description |
|---|---|
| Name| Indicates the service name. Note that sometimes this is different from the display name. You can get a list of the services and their current state with the Get-Service cmdlet.|
| BuiltInAccount| Indicates the sign-in account to use for the service. The values that are allowed for this property are:
<ul><li>LocalService</li>


<li>LocalSystem</li>


<li>NetworkService</li></ul> |
| BuiltInAccount| Indicates the sign-in account to use for the service. The values that are allowed for this property are: **LocalService**, **LocalSystem**, and **NetworkService**.|
| Credential| Indicates credentials for the account that the service will run under. This property and the __BuiltinAccount__ property cannot be used together.|
| 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"`.|
| StartupType| Indicates the startup type for the service. The values that are allowed for this property are:
<ul><li>Automatic</li>
<li>Disabled</li>
<li>Manual</li> |
| StartupType| Indicates the startup type for the service. The values that are allowed for this property are: **Automatic**, **Disabled**, and **Manual**|
| State| Indicates the state you want to ensure for the service.|

## Example

```powershell
Service ServiceExample
{
Expand Down
1 change: 0 additions & 1 deletion dsc/windowsProcessResource.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# DSC WindowsProcess Resource


> Applies To: Windows PowerShell 4.0, Windows PowerShell 5.0
The **WindowsProcess** resource in Windows PowerShell Desired State Configuration (DSC) provides a mechanism to configure processes on a target node.
Expand Down

0 comments on commit db670ed

Please sign in to comment.