DSC Sample for Windows PowerShell
You may need to follow some rule to test this sample. This is for your ease test.
- Accessible with Server and Node by Http.
- Pull Server and Node are same Password.
- Enabled PSRemoting.
- Execution Policy is "Remote Signed" or "ByPass"
- Run with Windows Server 2012 R2. (not Windows Server 2012 + WMF 4.0)
This session is for PowerShell users to introduce PowerShell DSC Pull mode. There are several Demo to understand how DSC Pull is working.
- Create 2 instances. 1 is for DSC PULL Server, the other is Pull Node.
- Clone repogitory into any path of Pull Server.
- Edit ConfigurationData by run
DSCSample\PowerShellSessionVol3\Edit-ConfigurationData.ps1
as PowerShell. You may find IPAddress is assign to role, change it as you like. - After step complete, close ISE.
- Open ISE and Run
DSCSample\PowerShellSessionVol3\PullServer\DownloadResource
and it will install PSDSCPullServer into your host. - Open IE and try
http://127.0.0.1:8080/PSDSCPullServer/PSDSCPullServer.svc
. If XML then installation is success. - After step complete, close ISE.
- Open ISE and Run
DSCSample\PowerShellSessionVol3\LCM\ChangeNodeToPull.ps1
. to change your node from PUSH to PULL. - If Get-DSCLocalConfigurationManager > RefreshMode show as Pull, LCM change is success.
- After step complete, close ISE.
- Open ISE and Run
DSCSample\PowerShellSessionVol3\Configuration\CombineWebServer.ps1
. This will immediately execute node to retrieve mof from PULL Server. - This script runs
Get-DSCConfiguration
. If this shows as File is present, then configuration is success. - After step complete, close ISE.
- DSC Also allows you to nest your configuration. Open ISE and Run
DSCSample\PowerShellSessionVol3\PullServer\DownloadResource\Download-xWebAdministration.ps1
. This download resource and set to module foler. - After step complete, close ISE.
- Open ISE and Run
DSCSample\PowerShellSessionVol3\Configuration\CombineWebServer.ps1
. - If node Firewall is open, then
http://NODEIP:7070/
will show you iisstart.htm
- If you use
DSCSample\PowerShellSessionVol3\PullServer\DownloadResource\Download-xDscDiagnostics.ps1
then you can Diagnostic DSC operations. - install module inside PULL Server and Node. Run
DSCSample\PowerShellSessionVol3\Configuration\CheckDSCoperations.ps1
. Valentia will help you invoke without thinking Credential.
That's all. Try DSC Pull and have a fun!
You may understand what LCM is doing. This is base understanding of DSC and must understand at first.
- What DSC Local Configuration Manager works with DSC Pull.
- Each parameters you can congfigure in LCM for PULL.
- Get current LCM Configuration.
- Set LCM Configuration to PULL.
Resource is the thing that indicate what DSC Configuration can do.
Resource will allow code hint for PowerShell to write Configuration and also create mof which apply to node.
If you want to do anything with Resources, you may need to get/write resource. I will not explain how to write resouce in this section.
- How to download resource.
- Where to set resource.
- How to allow node to donwload resource.
You can create pull server in 3 sec. Wow! great DSC is.
- Write Configuration for Pull Server.
- Apply configuration for DSC PULL Server creation.
Now the time you can write configuration!
Configuration is not different with PUSH or PULL, just write it as you want:)
- Simple configuration to create File content.
- Simple configuration to pass node inforamtaion with ConfigurationData.
- How to nest configuration in 1 source.
- How to nest configuration with separate configuration file.
The main difference with PUSH and PULL is how node reach to mof.
With PULL Mode, Node should recognise "which mof is mine?". You may need to find mof for THE NODE.
- Where to set mof for Pull?
- How to match mof with node?
- How to detect change in mof?
Last point is apply. Apply will be run from NODE, not DSC Pull Server.
- How to controll apply duration.
- How to apply immediately.
- How to trace DSC operation log.
- How to check "Which server was when applied"?
- How to change configuration to be applied.
That's set. Let's dive into DSC Pull world.