I'm currently trying to determine if a computer is in a "pending reboot" status after applying Microsoft patches in a VB program I'm writing. I have the following:
Private Sub DoesKeyExist()
Dim regKey As Microsoft.Win32.RegistryKey
regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\WindowsUpdate\\Auto Update\\RebootRequired", True)
If regKey Is Nothing Then
MsgBox("No reboot pending.")
Else
MsgBox("Reboot is pending")
End If
End Sub
This isn't working, however, and just returns Nothing each time. Any suggestions? Thanks