Skip to content

Instantly share code, notes, and snippets.

@stevenfollis
Last active November 11, 2017 22:30
Show Gist options
  • Save stevenfollis/0983692aab03be251d168e81fe7e56e6 to your computer and use it in GitHub Desktop.
Save stevenfollis/0983692aab03be251d168e81fe7e56e6 to your computer and use it in GitHub Desktop.
# Create directory to hold module files
mkdir -Force C:\DSC
#=================================
# Install xPendingReboot Module
# https://github.com/PowerShell/xPendingReboot
#=================================
# Download xPendingReboot
Invoke-WebRequest `
-UseBasicParsing `
-OutFile "C:\DSC\xPendingReboot.zip" `
-Uri "https://github.com/PowerShell/xPendingReboot/archive/master.zip"
# Unzip Module and move to PowerShell's Modules Folder
Expand-Archive `
-LiteralPath "C:\DSC\xPendingReboot.zip" `
-DestinationPath "C:\DSC" `
-Force
# Move folder to PowerShell's Modules Folder
Move-Item `
-LiteralPath "C:\DSC\xPendingReboot-master" `
-Destination "C:\Program Files\WindowsPowerShell\Modules\xPendingReboot"
#=================================
# Install xWindowsUpdate Module
# https://github.com/PowerShell/xWindowsUpdate
#=================================
# Download xPendingReboot
Invoke-WebRequest `
-UseBasicParsing `
-OutFile "C:\DSC\xWindowsUpdate.zip" `
-Uri "https://github.com/PowerShell/xWindowsUpdate/archive/master.zip"
# Unzip Module and move to PowerShell's Modules Folder
Expand-Archive `
-LiteralPath "C:\DSC\xWindowsUpdate.zip" `
-DestinationPath "C:\DSC" `
-Force
# Move folder to PowerShell's Modules Folder
Move-Item `
-LiteralPath "C:\DSC\xWindowsUpdate-master" `
-Destination "C:\Program Files\WindowsPowerShell\Modules\xWindowsUpdate"
#=================================
# Execute DSC
#=================================
Invoke-WebRequest `
-UseBasicParsing `
-Uri "https://gist.githubusercontent.com/stevenfollis/0983692aab03be251d168e81fe7e56e6/raw/UCP.ps1" `
-OutFile "C:\DSC\UCP.ps1" `
-ErrorAction SilentlyContinue
cd C:\DSC
. .\UCP.ps1
UCP
Start-DscConfiguration `
-Wait `
-Verbose `
-Path "C:\Users\eeadmin\Downloads\CreateADPDC\SetupDockerUCP" `
-Force
# Clean Up
<#
Remove-Item `
-LiteralPath "C:\DSC" `
-Recurse `
-Force
#>
Configuration SetupDockerUCP
{
Import-DscResource -ModuleName PSDesiredStateConfiguration, xPendingReboot, xWindowsUpdate
Node localhost
{
xPendingReboot Reboot
{
Name = 'BeforeSoftwareInstall'
}
LocalConfigurationManager
{
RebootNodeIfNeeded = $True
}
xWindowsUpdateAgent WindowsUpdate
{
IsSingleInstance = 'Yes'
UpdateNow = $True
Category = @('Security','Important', 'Optional')
Source = 'MicrosoftUpdate'
Notifications = 'Disabled'
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment