Let's say some windows 10.
-------------
Demo: Pull Client Configuration
ClientConfig.ps1
----------
param ( [Parameter(Mandatory)] [string] $ConfigurationServerUrl, [Parameter(Mandatory)] [string] $ConfigurationServerKey ) [DSCLocalConfigurationManager()] configuration PullClientConfiguration { node localhost { Settings { AllowModuleOverwrite = $True; ConfigurationMode = 'ApplyAndAutoCorrect'; ConfigurationModeFrequencyMins = 60; RefreshMode = 'Pull'; RefreshFrequencyMins = 30 ; RebootNodeIfNeeded = $true; } #specifies an HTTP pull server for configurations ConfigurationRepositoryWeb DSCConfigurationServer { ServerURL = $Node.ConfigServer; RegistrationKey = $Node.ConfigServerKey; AllowUnsecureConnection = $true; ConfigurationNames = @("DemoConfig") } #specifies an HTTP pull server for sending reports ReportServerWeb DSCReportServer { ServerURL = $Node.ConfigServer; RegistrationKey = $Node.ConfigServerKey; AllowUnsecureConnection = $true; } PartialConfiguration DemoConfig { Description = "DemoConfig" ConfigurationSource = @("[ConfigurationRepositoryWeb]DSCConfigurationServer") } } } $configParams = @{ AllNodes = @( @{ NodeName = 'localhost' ConfigServer = $ConfigurationServerUrl ConfigServerKey = $ConfigurationServerKey } ) } PullClientConfiguration -ConfigurationData $configParams
New-PullClient.ps1
#New-PullClient.ps1 #------------------- $ErrorActionPreference = 'Stop' if((Get-ExecutionPolicy) -eq 'Restricted') { throw 'Execution policy should be set atlease to RemoteSigned..' } if(-not(Test-WSMan -ErrorAction SilentlyContinue)) { Set-WSManQuickConfig -Force } $configServerUrl = 'http://pullserver9392.cloudapp.net/PSDSCPullServer.svc/' $configServerKey = 'c944ce11-0ffe-467b-bb22-fd1cd2fd769l' .\ClientConfig.ps1 -ConfigurationServerUrl $configServerUrl ` -ConfigurationServerKey $configServerKey Set-DscLocalConfigurationManager -Path .\PullClientConfiguration -Verbose -Force
.\New-PullClient.ps1
get-dsclocalconfigurationmanager
Update-DscConfiguration -Wait -Verbose
No comments:
Post a Comment