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.
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.
3 thoughts on “Creating a PowerShell Clock”
Comments are closed.