Skip to content
Menu
The Lonely Administrator
  • PowerShell Tips & Tricks
  • Books & Training
  • Essential PowerShell Learning Resources
  • Privacy Policy
  • About Me
The Lonely Administrator

Creating a PowerShell Clock

Posted on November 9, 2021November 9, 2021

I've published a new project to the PowerShell Gallery. This is something that I needed, and maybe you do as well. Even though I have the typical clock running in the Windows taskbar, I have an ultrawide monitor so it isn't always easy to read. I had been running the xclock app from WSL which was nice. But realized what I really wanted was a WPF-based clock that would display a formatted date-time string on my desktop.

Manage and Report Active Directory, Exchange and Microsoft 365 with
ManageEngine ADManager Plus - Download Free Trial

Exclusive offer on ADManager Plus for US and UK regions. Claim now!

The xclock application allows you to customize the DateTime format and I wanted the same option.

I spent a day writing the PSClock module which you can install from the PowerShell Gallery.

Install-Module PSClock

The module will run in both Windows PowerShell and PowerShell 7 on Windows. The module will also install the ThreadJob module if it isn't already installed.

The Start-PSClock command lets you create a WPF form that displays a formatted DateTime string in a transparent form. The form runs in a separate PowerShell runspace. You can control the form through a synchronized hashtable. Although I use the Set-PSClock function which abstracts this process.

Normally, I'd write about the technical details here. Instead, I wrote a design document which I encourage you to read here, as well as poking through the code on GitHub. I'd also recommend looking at the project's README file.

I hope you'll give it a try and let me know what you think.


Behind the PowerShell Pipeline

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to print (Opens in new window) Print
  • Click to email a link to a friend (Opens in new window) Email

Like this:

Like Loading...

Related

3 thoughts on “Creating a PowerShell Clock”

  1. Pingback: Creating a PowerShell Clock - The Lonely Administrator - Syndicated Blogs - IDERA Community
  2. Pingback: Creating a Clock with Powershell – Curated SQL
  3. Pingback: PowerShell SnippetRace 45-2021 | PowerShell Usergroup Austria

Comments are closed.

reports

Powered by Buttondown.

Join me on Mastodon

The PowerShell Practice Primer
Learn PowerShell in a Month of Lunches Fourth edition


Get More PowerShell Books

Other Online Content

github



PluralSightAuthor

Active Directory ADSI Automation Backup Books CIM CLI conferences console Friday Fun FridayFun Function functions Get-WMIObject GitHub hashtable HTML Hyper-V Iron Scripter ISE Measure-Object module modules MrRoboto new-object objects Out-Gridview Pipeline PowerShell PowerShell ISE Profile prompt Registry Regular Expressions remoting SAPIEN ScriptBlock Scripting Techmentor Training VBScript WMI WPF Write-Host xml

©2025 The Lonely Administrator | Powered by SuperbThemes!
%d