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.
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:
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.
When the server comes back everything is restored.
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.
The most current version looks like this:
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?
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