feat(WindowsUpdate.DisableAutoRestart): first ver!

This commit is contained in:
Iristyle
2013-04-13 07:25:07 -04:00
parent aa603fbb01
commit d37916f35d
3 changed files with 50 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
$package = 'WindowsUpdate.DisableAutoRestart'
try {
# http://support.microsoft.com/kb/555444
# alternate using GPO: http://kevinjameshall.wordpress.com/2012/12/26/windows-8-updates-disable-auto-restart/
$setRegistryKey = @"
`$params = @{
Path = 'HKLM:Software\Policies\Microsoft\Windows\WindowsUpdate\AU';
Name = 'NoAutoRebootWithLoggedOnUsers';
Value = 1
};
if (!(Test-Path `$params.Path)) { New-Item -Path `$params.Path -Force | Out-Null };
Set-ItemProperty @params
"@
Start-ChocolateyProcessAsAdmin $setRegistryKey
Write-ChocolateySuccess $package
} catch {
Write-ChocolateyFailure $package "$($_.Exception.Message)"
throw
}