Home > Powershell > PowerShell Countdown Timer

PowerShell Countdown Timer


As a Premier Field Engineer for Microsoft, I'm often presenting workshops to classrooms of people on various technologies.  During these workshops we take breaks and work on labs and it's nice to have some kind of countdown timer to show the attendees how much time is left in a break or until we begin the next module for example.

Sysinternals has a very useful tool called ZoomIt which allows presenters to zoom in, draw, and even display a countdown timer on the screen.  While this tool is well designed and is even used by many PFE’s around the world, including myself, and while it includes useful features such as playing a sound when the timer has completed and even displaying a background image, it left me wanting more.  I just wanted something basic that I could use when presenting PowerShell material that would allow me to simply specify a time and a message… so I made my own.

Head after the jump to download the script.

I wrote a script that would allow me to display a popup countdown timer from within the PowerShell console.  The script I wrote is provides two different countdown timers: one is very basic and just displays a simple two line countdown, the other is a bit more advanced and displays an “F7 style” popup window like in the screenshot above.  It looks pretty nice even though you're still limited to the font size of your shell (I always have mine set high (12×16) for projection screens anyway).  You can use the built-in Windows magnifier to enlarge it even more if you really want.

Here are a few usage examples, but you can see everything by looking at the comment-based help by running get-help .\display-countdown.ps1 -full

Usage examples:

————————– EXAMPLE 1 ————————–

C:\PS>.\display-countdown.ps1 -Minutes 15 -Message "Time until break is over"

This will display a simple text-based countdown that will expire 15 minutes from the time it was called, displaying the specified message as a header.


————————– EXAMPLE 2 ————————–

C:\PS>.\display-countdown.ps1 -Until (get-date).AddHours(1) -Message "Lunch break" -Popup

This will display a countdown timer that will expire in one hour from the time it was called, displayed "Lunch break" as the caption.  This example displays in the more user friendly popup mode.


————————– EXAMPLE 3 ————————–

C:\PS>.\display-countdown.ps1 -Countdown ([TimeSpan]::FromMinutes(10)) -Message "Bio Break" -NoClear

This will display a simple text-based countdown that will expire 10 minutes from the time it was called, displaying "Bio Break" as the header.  This call does not clear the screen of its contents before running. 


Download display-countdown.ps1Download display-countdown.ps1

Categories: Powershell Tags: , ,
You must be logged in to post a comment.