scom pending reboot management pack

by Nathan

(Hopefully) Useful Information on Microsoft System Center, Hyper-V and Cloud

Previous Post
Next Post
34
David Allen
SCOM – Pending Reboot Management Pack

Posted on July 15, 2015

Today, I put together another management pack for SCOM, and this time this management pack monitors if servers need a reboot.

The management checks for a pending reboot requirement in four places…  These three registry locations are checked for values that indicate a reboot is required:

HKLM\System\CurrentControlSet\Control\Session Manager
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update
HKLM\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing

And, Microsoft.Update.SystemInfo is queried for a requirement to reboot.

After testing though, I did notice that some applications can create registry entries that would normally indicate that a system reboot is required, however a reboot isn’t actually required, it’s just the way the app works.  Therefore, I have also added the ability to configure whether the reg keys are checked, or if Microsoft.Update.SystemInfo is queried, or both.  This can be configured by overriding the Script Arguments property on the monitor to one of these values:

“11” – All reg keys and SystemInfo queried (Default)

“01” – No reg keys checked, only SystemInfo queried

“10” – All reg keys checked, SystemInfo not queried

 

Other useful information:

Monitor is disabled by default – An override will be required to Enable it!
Monitor target:  Windows Server Operating System
Frequency:  Once per day (Overrideable)
Sync Time:  09:00 (Overrideable)
Timeout:  60 seconds (Overrideable)
Tested on Windows Server 2003 through to 2012 R2

An alert will be generated for each server that requires rebooting…

Download the management pack at the TechNet Gallery.

As ever, please let me know if you have any issues or feedback!

David

Share this:
Click to share on Twitter (Opens in new window)
Click to share on Facebook (Opens in new window)
Click to share on Google+ (Opens in new window)
Click to share on LinkedIn (Opens in new window)
Click to email this to a friend (Opens in new window)
Click to print (Opens in new window)
Click to share on Skype (Opens in new window)
Click to share on WhatsApp (Opens in new window)
Related

Tags: Management Pack, SCOM

34 Comments
ALex February 16, 2016

I have imported your MP and changed the override to 01. Default override was throwing too many irrelevant alerts. I guess without further research I won’t know why so many registry keys reporting a reboot requirement in our environment.
Thanks for this nice MP though!

Reply
Saleha March 4, 2016

I am unable to Enable the Monitor. I have tried over riding the value to Enable it and still the monitor is not enabled or greyed out. DO I have to choose the Management pack as well to enable it?

Reply
David Allen March 12, 2016

When you override a monitor to enable it, it will still stay grey in the console, as the monitor in the sealed management pack is disabled. You should find though that when opening Health Explorer on an object, that the monitor is running.

Reply
Dave March 9, 2016

LOVE THIS MP!!! have a question though. I am getting too many FPs with the PendingFileRenameOperations regkey check. I tried removing this entry in the script along with the associated strRebootRequired1 references but now the monitor does not work

here is what the edited looks like. any idea what I need to fix to chk only the 2 regkeys that I am looking to check along with the WUA check? much appreciated.

Option Explicit

Const HKEY_LOCAL_MACHINE = &H80000002

Dim oArgs, strRequired
Set oArgs = WScript.Arguments
strRequired = oArgs.Item(0)

Dim oAPI
Set oAPI = CreateObject(“MOM.ScriptAPI”)

Dim strRebootRequired2, strRebootRequired3, strRebootRequired4

Function RegistryReadMulti (strKeyPath, strValueName)
Dim strComputer, objRegistry, strValue
strComputer = “.”
Set objRegistry = GetObject(“winmgmts:\\” & _
strComputer & “\root\default:StdRegProv”)

objRegistry.GetMultiStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue
If IsNull(strValue) Then
RegistryReadMulti = “1”
Else
RegistryReadMulti = “2”
End If
End Function

Function RegistryRead (strKeyPath, strValueName)
Dim strComputer, objRegistry, strValue
strComputer = “.”
Set objRegistry = GetObject(“winmgmts:\\” & _
strComputer & “\root\default:StdRegProv”)

objRegistry.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue
If IsNull(strValue) Then
RegistryRead = “1”
Else
RegistryRead = “2”
End If
End Function

If strRequired = “11” Or strRequired = “10” Then
strRebootRequired2 = RegistryRead(“SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update”, “RebootRequired”)
strRebootRequired3 = RegistryRead(“Software\Microsoft\Windows\CurrentVersion\Component Based Servicing”, “RebootPending”)
Else
strRebootRequired2 = “1”
strRebootRequired3 = “1”
End If

If strRequired = “11” Or strRequired = “01” Then
Dim objSysInfo
Set objSysInfo = CreateObject(“Microsoft.Update.SystemInfo”)

If objSysInfo.RebootRequired = True Then
strRebootRequired4 = “2”
End If
Else
strRebootRequired4 = “1”
End If

Dim oBag
Set oBag = oAPI.CreatePropertyBag()

If strRebootRequired2 = “2” Or strRebootRequired3 = “2” Or strRebootRequired4 = “2” Then
oBag.AddValue “RebootRequired”, “YES”
Else
oBag.AddValue “RebootRequired”, “NO”
End If

oAPI.Return(oBag)

Reply
David Allen March 12, 2016

I’ll take a look and get back to you…

Reply
Dave March 23, 2016

cool! much appreciated. I think the reg check that was giving me FPs is the “PendingFileRenameOperations”. I noticed that although this is a valid pending reboot check, it was pending file renames due to situations other than windows update. if I could get this vbs with the WUA check, WindowsUpdate\Auto Update\ RebootRequired, and Component Based Servicing\RebootRequired that would be awesome. thanks again david

Reply
Ferran October 5, 2017

I have the same issue, but I can’t modify the script because the MP is sealed.

Option Explicit

Const HKEY_LOCAL_MACHINE = &H80000002

Dim oArgs, strRequired
Set oArgs = WScript.Arguments
strRequired = oArgs.Item(0)

Dim oAPI
Set oAPI = CreateObject(“MOM.ScriptAPI”)

Dim strRebootRequired1, strRebootRequired2, strRebootRequired4

Function RegistryReadMulti (strKeyPath, strValueName)
Dim strComputer, objRegistry, strValue
strComputer = “.”
Set objRegistry = GetObject(“winmgmts:\\” & _
strComputer & “\root\default:StdRegProv”)

objRegistry.GetMultiStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue
If IsNull(strValue) Then
RegistryReadMulti = “1”
Else
RegistryReadMulti = “2”
End If
End Function

Function RegistryRead (strKeyPath, strValueName)
Dim strComputer, objRegistry, strValue
strComputer = “.”
Set objRegistry = GetObject(“winmgmts:\\” & _
strComputer & “\root\default:StdRegProv”)

objRegistry.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue
If IsNull(strValue) Then
RegistryRead = “1”
Else
RegistryRead = “2”
End If
End Function

If strRequired = “11” Or strRequired = “10” Then
strRebootRequired1 = RegistryRead(“SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update”, “RebootRequired”)
strRebootRequired2 = RegistryRead(“Software\Microsoft\Windows\CurrentVersion\Component Based Servicing”, “RebootPending”)
Else
strRebootRequired1 = “1”
strRebootRequired2 = “1”
End If

If strRequired = “11” Or strRequired = “01” Then
Dim objSysInfo
Set objSysInfo = CreateObject(“Microsoft.Update.SystemInfo”)

If objSysInfo.RebootRequired = True Then
strRebootRequired4 = “2”
End If
Else
strRebootRequired4 = “1”
End If

Dim oBag
Set oBag = oAPI.CreatePropertyBag()

If strRebootRequired1 = “2” Or strRebootRequired2 = “2” Or strRebootRequired4 = “2” Then
oBag.AddValue “RebootRequired”, “YES”
Else
oBag.AddValue “RebootRequired”, “NO”
End If

oAPI.Return(oBag)

Reply
Tabish May 8, 2016

I only want to monitor pending reboot because of Windows update installed via group policy. What changes I should do ?

This MP contains report of pending reboot servers by any chance ?

Reply
Pritam March 7, 2017

Hello David, Why here two type of time check have been given? One specifying “Time at which Interval Needs to start” & another “Frequency” of the monitor. It would have been preferable to give only Frequency for time check. Is there any way to avoid the check for “Time at which Interval Needs to start” as part of the Overrides? Kindly respond. Thanks.

Reply
David Allen May 26, 2017

Hi, the time at which interval needs to start is the SyncTime. If you don’t require this, you could go into the management pack XML and remove the value for SyncTime.

If you do that, the line containing SyncTime should look like this…

David

Reply
Richard July 7, 2017

Hi is it possible to change the health state from critical to warning or info ?thanks

Reply
David Allen July 7, 2017

Hi, you can change the alert severity to warning or information using the ‘Alert severity’ override.

Reply
Richard July 7, 2017

Hi david I mean we already get the alerts in the info section but now I am monitoring on critical servers and see all the servers having a critaical state.I would like to change that to warning or info. in the monitor at the health tab you only see critical when the monitor condition is unhealthy .. can I change this to warning? thanks in advance

Reply
David Allen July 7, 2017

Unfortunately that’s not an overrideable parameter… It’s a small change in the management to alter that, but it will need to be done in the unsealed version and then resealed to main upgradeability. I’ll try and find some time over the weekend to compile a new version for you.

Reply
Richard July 13, 2017

Hi David did you had any time to compile a new version?

Richard July 7, 2017

Hi David thank you very much
have a nice weekend

Kind regard richard

Reply
Ferran September 25, 2017

David Allen, thank you very much for your nice MP, can you share with me the new version modified with the request of Richard?
Thank u very much in advance.

Reply
David Allen October 8, 2017

New version of the MP is now downloadable on the TechNet Gallery using the link in this post. The monitor is now set to Warning and I have included the unsealed copy.

David

Reply
David Allen October 8, 2017

Hi Richard,

Sorry for the delay but I have now updated the management pack downloadable from TechNet Gallery which now has the monitor state set to warning instead of critical. I have also included the unsealed copy of the MP is you want to make any further edits.

David

Reply
Richard November 9, 2017

Thank you very much !

Reply
Richard November 9, 2017

Hi David

Thank you very much!

Reply
Tom September 7, 2017

Hi, Cool management pack – is there a way for it to only query pending reboots after windows updates are installed? I am not sure where the script is to edit this?
Thanks

Reply
David Allen October 8, 2017

The script monitors on a timed interval, so it will query at some pint after updates have been installed.

As to only running after updates are installed, that would require a complete rewrite as it would need to assess when the last updates where installed and then query or not.

David

Reply
Simon October 10, 2017

Hi,
Just noticed the new management pack is version 1.0.0.1, the old one is 1.0.0.4 so you cant do an in place management pack upgrade unless ripping it totally out. Is this a mistake your side that you can amend?

Thanks Simon

Reply
David Allen October 10, 2017

That is a mistake my side… Thanks for letting me know, and I’ll get it sorted later this evening!

Reply
Simon October 11, 2017

Great stuff…
Thank you

Reply
Richard November 9, 2017

Hi did you already compile a pack with a new version number? 1.0.0.4?
thanks Richard

Reply
Janne January 24, 2018

Hi!
The pack that you can download from technet gallery still has version 1.0.0.1?

Reply
Claus Leclercq January 30, 2018

Great MP. How difficult it will be , to place the reboot reason in the Alert message ?

Thanks Claus

Reply
Inder February 20, 2018

Guys, May i have step by step guide for the implementation as i have installed and imported Management pack and it shows under installed MP however i could not locate Monitor which need to override. Thanks in Advance.

Reply
Richard May 1, 2018

Hi David thanks for the last change but is it also possible to choose for informational alerting state. ( settings)

Reply
Bob June 1, 2018

Hi David, How your scrip is querying SystemInfo? Could you elaborate it. I am getting false alerts after changing Script Arguments property to “01”

& what is the requirement on Agent side for the MP to wrok? like, Server should allow scripts to execute etc.?

Reply
Mark Swart July 12, 2018

I have this working in SCOM 2012 and it is great, have a daily report emailed to the IT staff. When I tried recreating it in SCOM 2016 I get nothing. I did remove and re-import the MP though as someone else imported it 2x and never got it working.

Reply
Mark Swart July 17, 2018

Currently have this working in SCOM 2012. Trying to get it working in SCOM 2016 with no luck. It’s enabled in 2016, no servers show up (and should). A query of the DB shows nothing in there. If I check the properties of the monitor I get “No Operational state has been mapped to a critical health state. Please select the monitor is in a warning state for alerting or change the mapping of the operational state from warning to critical in the health tab.

Reply
Leave a Reply

Notify me of follow-up comments by email.

Notify me of new posts by email.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts
Azure Stack – Development Kit (Single Node)
Cireson Survey – Pre-Selecting The Satisfaction Slider
SCOM – Monitor SCSM Data Warehouse Jobs
SCOM – Updated Unsealed MP Backup Management Pack
Microsoft Azure – Securing Accounts With Access To The EA Portal
Archives
October 2017
September 2017
July 2017
November 2016
August 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
May 2015
February 2015
October 2014
September 2014
Categories
Azure
Azure Automation
Azure Stack
Cireson
Cluster
Configuration Manager
Data Protection Manager
Data Warehouse
Events
Hyper-V
Ignite
Management Packs
Microsoft Azure
OMS
Operations Manager
Orchestrator
Password Reset
Portal
PowerShell
SCU Europe
Service Manager
System Center
TechEd
Uncategorized
Updates
Visual Studio
Welcome
Windows Azure Pack
Windows Server 2012 R2
Windows Server 2016
Tags
Automation Azure Backup Barcelona Cireson Cloud Compliance Containers Dashboard Data Warehouse DCM DPM Events Grooming Hyper-V Ignite iPad Library Sharing Log Shipping Management Pack MPSync MVP Performance PowerShell Remediation Reporting RSAT SCCM SCOM SCSM SCU SQL SquaredUp System Center System Center 2016 Tape TechEd Technical Preview Update Rollup VMM WAP Window Server Windows Server Windows Server 2016 Workflow
Useful Sites
Aquilaweb Cloud Solutions
ClustrMap
MVP

© 2018 – Design by Frenchtastic.eu

Back to top