From 81d7d4728bda4af924a66fbe769846e1bcf89a82 Mon Sep 17 00:00:00 2001 From: Alex Hirsch Date: Mon, 10 Aug 2015 00:37:53 +0200 Subject: [PATCH] add installer script for Windows Update Powershell module --- scripts/install-windows-update-ps-module.ps1 | 25 ++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 scripts/install-windows-update-ps-module.ps1 diff --git a/scripts/install-windows-update-ps-module.ps1 b/scripts/install-windows-update-ps-module.ps1 new file mode 100644 index 0000000..be29f87 --- /dev/null +++ b/scripts/install-windows-update-ps-module.ps1 @@ -0,0 +1,25 @@ +# Description: +# This script will setup the Windows Update Powershell module. With it you will +# be able to download, install, uninstall and hide Windows updates using +# Powershell. For a list of commands invoke +# `PS> Get-Command -Module PSWindowsUpdate`. + +$ErrorActionPreference = "Stop" + +$download_uri = "https://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc/file/41459/43/PSWindowsUpdate.zip" + +echo "Downloading PSWindowsUpdate zipfile" + +# TODO replace this with wget when it works again on a clean install +$wc = new-object net.webclient +$wc.DownloadFile($download_uri, "$PSHOME/Modules/PSWindowsUpdate.zip") + +echo "Extracting PSWindowsUpdate zipfile" +Add-Type -AssemblyName "system.io.compression.filesystem" +[io.compression.zipfile]::ExtractToDirectory("$PSHOME/Modules/PSWindowsUpdate.zip", "$PSHOME/Modules/") + +echo "Removing zipfile" +rm "$PSHOME/Modules/PSWindowsUpdate.zip" + +echo "Import Module automatically when Powershell starts" +echo "Import-Module PSWindowsUpdate" >> "$PSHOME/profile.ps1"