Skip to content

Instantly share code, notes, and snippets.

@devblackops
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devblackops/a0091540bdfbda76f062 to your computer and use it in GitHub Desktop.
Save devblackops/a0091540bdfbda76f062 to your computer and use it in GitHub Desktop.
Configure DSC client with given GUID
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