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,28 @@
<?xml version="1.0"?>
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<metadata>
<id>WindowsUpdate.DisableAutoRestart</id>
<title>Disable Windows Update Auto-Restart</title>
<version>0.0.1</version>
<authors>Microsoft</authors>
<owners>Ethan Brown</owners>
<summary>Prevent your system from automatically restarting after automatically installing Windows Updates.</summary>
<description>Prevent your system from automatically restarting after automatically installing Windows Updates.
Sets the registry key HKLM:Software\Policies\Microsoft\Windows\WindowsUpdate\AU\NoAutoRebootWithLoggedOnUsers to 1
Alternatively, group policy can be used to set this as well:
http://kevinjameshall.wordpress.com/2012/12/26/windows-8-updates-disable-auto-restart/
</description>
<projectUrl>http://support.microsoft.com/kb/555444</projectUrl>
<tags>Windows WindowsUpdate</tags>
<licenseUrl>http://opensource.org/licenses/MIT</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<iconUrl>https://github.com/Iristyle/ChocolateyPackages/raw/master/WindowsUpdate.DisableAutoRestart/windows8.png</iconUrl>
<releaseNotes>
</releaseNotes>
</metadata>
<files>
<file src="tools\**" target="tools" />
</files>
</package>

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
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB