Last active
August 29, 2015 14:24
-
-
Save devblackops/a0091540bdfbda76f062 to your computer and use it in GitHub Desktop.
Configure DSC client with given GUID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[guid]$guid | |
) | |
$computerName = $env:COMPUTERNAME | |
[DSCLocalConfigurationManager()] | |
Configuration LCMPull { | |
param( | |
[string]$computer, | |
[guid]$guid, | |
[string]$pullServerUrl | |
) | |
Node $computer { | |
Settings { | |
ConfigurationID = $guid | |
RefreshMode = ‘Pull’ | |
ConfigurationMode = 'ApplyAndAutoCorrect' | |
AllowModuleOverwrite = $True | |
ConfigurationModeFrequencyMins = 30 | |
RefreshFrequencyMins = 30 | |
} | |
ConfigurationRepositoryWeb PullServer { | |
ServerUrl = $pullServerUrl; | |
AllowUnsecureConnection = ‘true’ | |
} | |
} | |
} | |
$tempDir = (Join-Path -Path $env:SystemDrive -ChildPath "Temp") | |
if (!(Test-Path -Path $tempDir)) { | |
New-Item -Path $tempDir -ItemType Directory | |
} | |
# Create the Computer.Meta.Mof in folder | |
$dir = LCMPull -computer $computerName -guid $guid -pullServerUrl '<pullserver>' -OutputPath $tempDir | |
Set-DSCLocalConfigurationManager –Computer $ComputerName -Path $dir.Directory –Verbose |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment