Introducing
IntroducingWindowsServer2016_ebook
IntroducingWindowsServer2016_ebook
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
The following is a typical implementation of a Meta Configuration property configuration in LCM v2:<br />
[DSCLocalConfigurationManager()]<br />
Configuration ChangeLCMProperties<br />
{<br />
Node DemoServerWin<br />
{<br />
Settings<br />
{<br />
AllowModuleOverwrite = $false<br />
RebootNodeIfNeeded = $true<br />
RefreshMode = "Pull"<br />
ConfigurationMode = "ApplyAndAutoCorrect"<br />
ConfigurationID = "fcd03a8d-5a64-4982-92b3-5c89680add39"<br />
}<br />
ConfigurationRepositoryWeb PullServer1<br />
{<br />
}<br />
ServerURL = "http://demoserverwin10:8090/PSDSCPullServer.svc/"<br />
AllowUnsecureConnection = $true<br />
ConfigurationRepositoryWeb PullServer2<br />
{<br />
ServerURL = "http://demoserverwin10:8080/PSDSCPullServer.svc/"<br />
AllowUnsecureConnection = $true<br />
}<br />
ReportServerWeb ComplianceServer<br />
{<br />
}<br />
ServerURL = "http://demoserverwin10:8000/PSDSCComplianceServer.svc/"<br />
AllowUnsecureConnection = $true<br />
}<br />
}<br />
PartialConfiguration IISInstall<br />
{<br />
Description = 'Configuration for IIS Web Server'<br />
ConfigurationSource = '[ConfigurationRepositoryWeb]PullServer1'<br />
}<br />
PartialConfiguration IndexFile<br />
{<br />
Description = 'Configuration for Index File'<br />
ConfigurationSource = '[ConfigurationRepositoryWeb]PullServer2'<br />
DependsOn<br />
= '[PartialConfiguration]IISInstall'<br />
}<br />
ChangeLCMProperties -OutputPath "C:\DSC"<br />
Set-DscLocalConfigurationManager -Path "C:\DSC"<br />
The preceding script is similar to general DSC configuration with the configuration named<br />
ChangeLCMProperties but including the defined DSCLocalConfigurationManager attribute. This<br />
attribute mandates that all resources within the configuration should be related to LCM only and<br />
should be present on configurations related to LCM. An error results if other general resources are<br />
used in the configuration. The script contains one node section for the DemoServerWin server.<br />
The Settings resource is the main resource for setting the LCM properties. In this example, we are<br />
specifying some of its properties and assigning values to them. For example, the refresh mode is set<br />
to Pull so that the machine should restart (when required by a resource); the configuration mode has<br />
been changed to ApplyandAutoCorrect, and ConfigurationID has been provided with a valid GUID.<br />
The configuration as represented by the GUID would be pulled from the pull server.<br />
There are two pull servers in this configuration denoted by PullServer1 and PullServer2. The<br />
ServerURL property shows that they are on the same server with different port numbers. Also,<br />
AllowUnsecureConnection makes it possible to use HTTP instead of HTTPS protocol. Compliance<br />
server information is also provided by using ReportServerWeb. There are two partial configurations set<br />
to be downloaded by LCM and applied as a single configuration on its server. Partial Configuration<br />
144 CHAPTER 5 | Systems management