Win10 Reboot Required

Started by stanl, January 22, 2020, 03:16:08 AM

Previous topic - Next topic

stanl

All of the below registry queries fail. Based on some googling they are supposed to detect if a reboot is required or the last one return the if the reboot notification is enabled. The second snippet runs one of the queries in PS and returns False. If I use [size=78%] [/size][/size]RegExistValue() it returns 0.


Code (WINBATCH) Select


;ret = RegQueryValue( @REGMACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\[RebootRequired]",64 )
;ret = RegQueryValue( @REGMACHINE, "System\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations",64 )
;ret = RegQueryValue( @REGMACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\[RebootPending]",64 )
ret = RegQueryValue( @REGMACHINE, "SOFTWARE\Microsoft\WindowsUpdate\UX\Settings[RestartNotificationsAllowed]",64 )
message( "Reboot Required: ", ret )





$rebootRequired = Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending"
"Pending reboot: $rebootRequired"

td

Is there a point to including a Powershell script here?  According to MSFT documentation, "the Test-Path cmdlet determines whether all elements of the path exist. It returns $True if all elements exist and $False if any are missing."

The description can also be used to describe the WIL RegExist* functions.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

stanl

My post had references to RegKeyExists, but got gobbled up with If I use [/size]RegExis

td

Since you were looking for a value and not a key, you would need to use RegExistValue to determine if one of your reboot related registry values exist or not.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade