Add methods for managing auto restart feature
This commit is contained in:
parent
b1e4560337
commit
9c7729ce56
|
@ -1,6 +1,8 @@
|
|||
using namespace Microsoft.Win32;
|
||||
|
||||
$null = New-Module {
|
||||
$wuPolicyPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate";
|
||||
|
||||
function Edit-DefaultUserKey {
|
||||
param(
|
||||
[scriptblock] $Action
|
||||
|
@ -53,4 +55,22 @@ $null = New-Module {
|
|||
function Disable-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