28.09.2016 Views

Introducing

IntroducingWindowsServer2016_ebook

IntroducingWindowsServer2016_ebook

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

IISInstall is responsible for downloading a configuration named IISInstall from PullServer1.<br />

Partial Configuration IndexFile is responsible for downloading a configuration named IndexFile from<br />

PullServer2. Moreover, running the partial configuration IndexFile depends on the completion of<br />

the configuration IISInstall as represented by the DependsOn property. Only after the IISInstall<br />

configuration is applied can the IndexFile configuration run.<br />

After the configuration is defined, it runs to generate the .mof file (DemoServerWin.Meta.mof) at<br />

C:\DSC. The folder location has been explicitly provided by using the OutputPath parameter. After the<br />

.mof file is generated, the Set-DSCLocalConfigurationManager cmdlet is used to push and apply the<br />

.mof file to the DemoServerWin server.<br />

When the configuration is applied, LCM on the server DemoServerWin is configured to pull partial<br />

configurations from multiple pull servers and apply them periodically.<br />

Next,you can read the new configuration again by using Get-DSCLocalConfigurationManager, as<br />

shown in the following example:<br />

PS C:\Users\me> Get-DscLocalConfigurationManager<br />

ActionAfterReboot<br />

: ContinueConfiguration<br />

AgentId<br />

: C8F7308B-6E6D-11E6-899F-B4AE2BEB7DE5<br />

AllowModuleOverWrite<br />

: False<br />

CertificateID :<br />

ConfigurationDownloadManagers<br />

: {[ConfigurationRepositoryWeb]PullServer1,<br />

[ConfigurationRepositoryWeb]PullServer2}<br />

ConfigurationID<br />

: fcd03a8d-5a64-4982-92b3-5c89680add39<br />

ConfigurationMode<br />

: ApplyAndAutoCorrect<br />

ConfigurationModeFrequencyMins : 15<br />

Credential :<br />

DebugMode<br />

: False<br />

DownloadManagerCustomData :<br />

DownloadManagerName :<br />

LCMCompatibleVersions : {1.0, 2.0}<br />

LCMState<br />

: Ready<br />

LCMVersion : 2.0<br />

MaximumDownloadSizeMB : 500<br />

StatusRetentionTimeInDays : 7<br />

PartialConfigurations<br />

: {[PartialConfiguration]IISInstall,<br />

[PartialConfiguration]IndexFile}<br />

RebootNodeIfNeeded<br />

: True<br />

RefreshFrequencyMins : 30<br />

RefreshMode<br />

: PULL<br />

ReportManagers<br />

: [ReportServerWeb]ComplianceServer<br />

ResourceModuleManagers : {}<br />

PSComputerName :<br />

In the preceding code block, the ConfigurationDownloadManagers property is filled with two values<br />

representing two pull servers: PartialConfigurations has two values represented by the IISInstall<br />

and IndexFile configurations, and ReportManagers has a value of ComplianceServer.<br />

New methods in LCM<br />

There are three new methods in LCM v2: GetConfigurationStatus, GetConfigurationResultOutput,<br />

and SendConfigurationApplyAsync. Let's examine these briefly.<br />

GetConfigurationStatus<br />

The GetConfigurationStatus method retrieves the current status of configuration for a server. The<br />

new DSC cmdlet Get-DSCConfigurationStatus invokes the CIM method. The following code shows an<br />

example of Get-DSCConfigurationStatus:<br />

PS C:\> $cimsession = New-CimSession -ComputerName DemoServerWin10<br />

PS C:\> Get-DscConfigurationStatus -CimSession $cimsession<br />

Status StartDate Type Mode RebootRequested<br />

NumberOfConfigurationResources PSComputerName<br />

------ --------- ---- ---- ---------------<br />

------------------------------ --------------<br />

145 CHAPTER 5 | Systems management

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!