From 15afb8ee8e8d4f5243480f8b347ef641c6a154fc Mon Sep 17 00:00:00 2001 From: Jaap Brasser Date: Mon, 9 May 2016 14:46:41 +0000 Subject: [PATCH] Added the Clear-WsusSettings script to this repository --- Clear-WsusSettings/Clear-WsusSettings.ps1 | 52 +++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Clear-WsusSettings/Clear-WsusSettings.ps1 diff --git a/Clear-WsusSettings/Clear-WsusSettings.ps1 b/Clear-WsusSettings/Clear-WsusSettings.ps1 new file mode 100644 index 0000000..8373e09 --- /dev/null +++ b/Clear-WsusSettings/Clear-WsusSettings.ps1 @@ -0,0 +1,52 @@ +function Clear-WsusSettings { +<# +.SYNOPSIS +Clears the Wsus settings from the registry + +.DESCRIPTION +This function removes several values regarding WSUS from the registry, temporarily allowing a local administrative users to download patches from Microsoft Update instead of the regularly defined WSUS server. If group policies are setup for this machine the WSUS settings might be reapplied depending on the GPO configuration. + +.NOTES +Name : Clear-WsusSettings +Author : Jaap Brasser +Version : 1.0.0 +DateCreated: 2016-05-09 +DateCreated: 2016-05-09 +Blog : http://www.jaapbrasser.com + +.LINK +http://www.jaapbrasser.com + +.EXAMPLE +. .\Clear-WsusSettings.ps1 + +Description +----------- +This command dot sources the script to ensure the Clear-WsusSettings function is available in your current PowerShell session + +.EXAMPLE +Clear-WsusSettings + +Description +----------- +Will purge the defined registry settings in the WindowsUpdate key + +.EXAMPLE +Clear-WsusSettings -WhatIf + +Description +----------- +Will display which changes will be made in the registry without actually making any changes +#> + [cmdletbinding(SupportsShouldProcess=$true)] + param () + $ErrorActionPreference = 'SilentlyContinue' + Remove-ItemProperty 'HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate' -Force -Name WUServer + Remove-ItemProperty 'HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate' -Force -Name TargetGroup + Remove-ItemProperty 'HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate' -Force -Name WUStatusServer + Remove-ItemProperty 'HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate' -Force -Name TargetGroupEnable + Set-ItemProperty 'HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU' -Value 0 -Force -Name UseWUServer + Set-ItemProperty 'HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU' -Value 0 -Force -Name NoAutoUpdate + Set-ItemProperty 'HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate' -Value 0 -force -Name DisableWindowsUpdateAccess + Restart-Service -Name wuauserv +} \ No newline at end of file