Last active
August 29, 2015 14:23
-
-
Save jamesallen-cm/2d08e881944da3cbcca6 to your computer and use it in GitHub Desktop.
February Preview DSCPullServer bootstrap
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
$Boxstarter.RebootOk=$true | |
# enable psremoting | |
Write-Output "Enabling PSRemoting" | |
Enable-PSRemoting -Force | |
# for write-zip file | |
cinst pscx -y | |
# manage updates from powershell | |
cinst pswindowsupdate -y | |
if($PSVersionTable.PSVersion -lt (New-Object 'Version' 5,0,10018,0)) | |
{ | |
# install WMF5.0 February | |
cinst powershell -version 5.0.10018-February2015Preview -pre -y | |
Write-Output "Restarting to complete installation" | |
Invoke-Reboot | |
} | |
else | |
{ | |
Write-output "Load nuget-anycpu.exe" | |
Get-PackageProvider -Name NuGet -ForceBootstrap | |
} | |
# install KB2883200 | |
# install KB3037315 | |
$KBList = "KB2883200", "KB3037315" | |
Get-WUInstall -Type "Software" -KBArticleID $KBList -AcceptAll | |
Import-Module Pscx | |
# Install the latest DSC modules | |
Write-Output "Install the latest DSC Resources from Powershell Gallery" | |
Find-DscResource | Where{$_.Name -like "x*" -or $_.Name -like "c*"} | Install-Module -Force | |
$mod = get-Module -Name xPSDesiredStateConfiguration | |
# Zip up the files and create checksums | |
Write-Output "Zip up the resources and create a checksum for each - Required for the pull server to send configs to a node" | |
$dscResources = "$env:ProgramFiles\WindowsPowerShell\Modules\" | |
$baseDestination = "$env:ProgramFiles\WindowsPowerShell\DscService\Modules\" | |
$versions = get-childitem -directory $dscResources | |
$versions | ForEach-Object -Process ` | |
{ | |
$moduleName = $_ | |
Import-Module $moduleName | |
$module = Get-Module -ListAvailable -FullyQualifiedName $moduleName.FullName | |
$zipDSCModule = $module.Name + "_" + $module.Version.ToString() + ".zip" | |
$zipDestination = $baseDestination + $zipDSCModule | |
# powershell community extensions needed for this | |
Write-Zip $("$dscResources\$moduleName\*") $zipDestination | |
} | |
# We need to zip up the installed version of PSDesiredStateConfiguration and put it in modules | |
$PSDSCModule = Get-Module PSDesiredStateConfiguration | |
$zipPSDSCModule = $PSDSCModule.Name + "_" + $PSDSCModule.Version + ".zip" | |
$zipDestination = $baseDestination + $zipPSDSCModule | |
Write-Zip $($PSDSCModule.Path) $zipDestination | |
# create the checksums for the pull modules | |
New-DscChecksum -ConfigurationPath $baseDestination | |
# Configure the DSCPullServer using the xPSDesiredStateConfiguration module |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment