Add methods for managing auto restart feature
This commit is contained in:
parent
b1e4560337
commit
9c7729ce56
|
@ -1,6 +1,8 @@
|
||||||
using namespace Microsoft.Win32;
|
using namespace Microsoft.Win32;
|
||||||
|
|
||||||
$null = New-Module {
|
$null = New-Module {
|
||||||
|
$wuPolicyPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate";
|
||||||
|
|
||||||
function Edit-DefaultUserKey {
|
function Edit-DefaultUserKey {
|
||||||
param(
|
param(
|
||||||
[scriptblock] $Action
|
[scriptblock] $Action
|
||||||
|
@ -53,4 +55,22 @@ $null = New-Module {
|
||||||
function Disable-BootMessage {
|
function Disable-BootMessage {
|
||||||
Set-BootMessage;
|
Set-BootMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Disables automatic reboots by Windows Update.
|
||||||
|
#>
|
||||||
|
function Disable-WindowsUpdateAutoRestart {
|
||||||
|
Set-ItemProperty "$wuPolicyPath\AU" `
|
||||||
|
-Name NoAutoRebootWithLoggedOnUsers `
|
||||||
|
-Value $Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Resets the automatic reboot state.
|
||||||
|
#>
|
||||||
|
function Reset-WindowsUpdateAutoRestart {
|
||||||
|
Remove-Item -Recurse "$wuPolicyPath";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue