Posted On February 8, 2022

How To Prevent Windows From Automatically Rebooting After Updates

kimconnect 0 comments
blog.KimConnect.com >> Codes >> How To Prevent Windows From Automatically Rebooting After Updates
# Add New Registry Key
$regHive='REGISTRY::HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU'
$keyname='NoAutoRebootWithLoggedOnUsers'
$value=1
Set-ItemProperty -Path $regHive -Name $keyname -value $value

# Validation
Get-ItemProperty $regHive -name $keyname

PS C:\WINDOWS\system32> Get-ItemProperty $regHive -name $keyname


NoAutoRebootWithLoggedOnUsers : 1
PSPath                        : Microsoft.PowerShell.Core\Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpd
                                ate\AU
PSParentPath                  : Microsoft.PowerShell.Core\Registry::HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpd
                                ate
PSChildName                   : AU
PSProvider                    : Microsoft.PowerShell.Core\Registry

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Sync AD OU Containers with Group Memberships

Script to Add Group Membership:for /f "tokens=*" %A IN ('dsquery user %PATH_TO_OU%') DO dsmod user…

PowerShell: Encapsulating Function Inside a Function and Inside an Invoke-Command or Job

$domain='google.com' function pingSomething($x){ $result=ping $x function getTraceroute($y){ pathping $y } $result+=getTraceroute $x return $result }…

PowerShell: Error While Invoking Functions Containing 2 Parameters

Issue: This function will raise an error when being invoked: function localFunc ($x, $y){ begin{}…