Subscribe to RSS feed  Follow @jackvamvas - Twitter

*Use the Comments section for questions Links


SQL Server DBA Jobs

How to check if Puppet is reboots a windows server with Powershell

23 August,2020 by Tom Collins

If you want a Powershell script to quickly check if Puppet has initiated a reboot on a Windows server , use this script . It uses the Powershell cmdlet -Get-WinEvent. 

Typically - a Puppet maintenance window is set per server. If a reboot is required , due to a pending patching change - than the reboot will occur during the designated window. A server owner may experience an unexpected outage - and will want to investigate the root cause. Part of the root cause may include analysing the Event viewer logs for clues. 

The Windows Event Logs stores loads of messages, so finding messages related to a Puppet initiated reboot can be a challenge. Executing this code will filter on the System log and the event id 1074, with an string in the Message   . 


Get-WinEvent -ComputerName  $computername -FilterHashtable @{logname='system';id=1074;}|?{$_.message -match "Puppet is rebooting"}

If you want to enhance this script and create a script , which you can execute from the powershell command line . 

param (
Get-WinEvent -ComputerName  $computername -FilterHashtable @{logname='system';id=1074;}|?{$_.message -match "Puppet is rebooting"}

You would execute the command line as:

PS C:\myscriptlibrary > .\myscriptname.ps1


Read more on powershell

Powershell Script – How to get windows logs events with Get-WinEvent for a date range


Author: Tom Collins (


Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.


Post a comment on How to check if Puppet is reboots a windows server with Powershell | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer