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.
You also need to provide the pull server details to LCM. In LCM v2, you can do so by<br />
using the WebConfigurationRepository resource. There can be multiple pull servers<br />
(WebConfigurationRepository resources) defined in a configuration. In the previous sample,<br />
two pull servers are defined: PullServer1 with server URL http://demoserverwin:8080/<br />
PSDSCPullServer.svc/ and AllowUnsecureConnection set to True, and PullServer2 with server<br />
URL http://Demoserverwin10:8090/PSDSCPullServer.svc/ and AllowUnsecureConnection set to True.<br />
Although this example shows a property called AllowUnsecureConnection, and setting it to True allows<br />
LCM to request configuration on HTTP protocol instead of HTTPS protocol, we strongly recommend<br />
that you use HTTPS in normal operating environments.<br />
The PartialConfiguration resource defines configuration fragments. Two partial configurations,<br />
IISInstall and IndexFile, are defined. IISInstall configuration is available on PullServer1, whereas<br />
IndexFile configuration is available on PullServer2. Important to note are the names of the partial<br />
configurations because they should exactly match the names of the configurations on the pull server.<br />
The next section will show that the IISInstall configuration is authored and available on PullServer1<br />
and the IndexFile configuration is available on PullServer1. The ConfigurationSource property<br />
attaches the pull server to the partial configuration.<br />
Also, note that the pull server URL, ConfigurationID, and Configuration Name combined provide the<br />
LCM with complete information to uniquely identify the configuration on the pull server. The LCM<br />
cannot pull partial configurations if any of these three pieces of information is missing.<br />
The configuration previously shown generates the DemoServerWin.meta.mof file at the C:\DSC folder<br />
location. You use the Set-DSCLocalConfigurationManager cmdlet to push and apply the .mof file to<br />
DemoServerWin.<br />
Authoring the configurations<br />
Next, we examine authoring the configurations that will participate in partial configuration. In this<br />
section, two configurations, IISInstall and IndexFile, are authored.<br />
IISInstall configuration<br />
This is a simple configuration responsible for installing IIS (Web-Server) on a server using the<br />
WindowsFeature resource. Running the configurations in this section and the next one generates<br />
.mof files. The configuration script in our sample that follows runs on server ServerWin10. The<br />
name of the .mof file is same as the node name defined in the configuration script. Configurations<br />
participating in partial configurations have a special naming requirement. They must use the<br />
..mof format. The configuration shown in the following<br />
sample uses ConfigurationData (data structure for passing values to configuration script) to define the<br />
name of the node. $AllNodes.NodeName retrieves all the node names from the configuration data,<br />
which in this case is only one because there is just one NodeName. IISInstall.fcd03a8d-5a64-4982-<br />
92b3-5c89680add39.MOF is generated from the following script:<br />
$ConfigInfoIIS = @{<br />
AllNodes = @(<br />
@{<br />
NodeName = "IISInstall.fcd03a8d-5a64-4982-92b3-5c89680add39"<br />
}<br />
)<br />
}<br />
Configuration IISInstall<br />
{<br />
Node $AllNodes.NodeName<br />
{<br />
WindowsFeature IIS<br />
{<br />
Name = "Web-server"<br />
Ensure = "Present"<br />
}<br />
149 CHAPTER 5 | Systems management