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

My Telemetry PowerShell Prompt Function

Posted on December 18, 2018December 18, 2018

I've enjoyed building these PowerShell prompt functions. Because performance is critical, it has forced me to create efficient code. For example, I've been using Get-CimInstance to retrieve select properties from certain classes. Because I know in advance what properties I need, I can tell Get-Ciminstance to only get and return those properties. With today's version, this is very important. This "telemetry" prompt combines a number of features from previous iterations into a more comprehensive snapshot of the state of a few critical servers.

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!

Use a Dynamic List of Servers

This prompt function also relies on runspace and synchronized hashtable to get system information from a small number of remote servers. You can modify the list on the fly. I recommend keeping this to a bare minimum unless you make your console screen wider or revise the function. By the way, if the default file C:\Scripts\watch.txt isn't found, the prompt will default to the localhost. Assuming a list exists and all the servers are up and running you can expect a prompt like this:

Detailed monitoring PowerShell prompt

As you can see there is some color coding. I'm using some graphical elements in front of some of the values to help you decipher the prompt.  Of course feel free to modify as you wish.

Show Offline Status

The function will also take into account if a server is offline.

Showing an offline server

When the server comes back everything is restored.

image

The code for this function, along with the others, is on Github.

I am still playing with the code so you might see slightly different output. Otherwise, enjoy and have some fun.


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

4 thoughts on “My Telemetry PowerShell Prompt Function”

  1. Jeffery Hicks says:
    December 18, 2018 at 1:09 pm

    The most current version looks like this:
    telemetry PowerShell prompt

  2. Gokmen says:
    December 20, 2018 at 7:59 am

    Hello
    MoreLunches.com site is not working. How can i find the lab answers of Learn Windows PowerShell 3 in a Month of Lunches book?

    1. Jeffery Hicks says:
      December 20, 2018 at 8:33 am

      That book has been updated a few times and that site, which Don maintained, I believe is gone. I’m not sure exactly which edition you have but you might check Manning.com for the materiasl. https://www.manning.com/books/learn-windows-powershell-in-a-month-of-lunches-second-edition

  3. Pingback: The Ultimate PowerShell Telemetry Prompt • The Lonely Administrator

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