Mr. Roboto

More Power for PowerShell

Need a boost in PowerShell amps? Take Power Gadgets out for a spin.

By now you've probably been kicking the tires of PowerShell for a while. I'm sure you'll agree that it will be a big help when it comes to managing your systems. PowerShell is here to stay and will only get better with time. If you're like Mr. Roboto, though, you always need more power and you need it now.

To boost the power you can get out of PowerShell, try adding Power Gadgets to your toolbox. Power Gadgets is a PowerShell snap-in that gives you graphical widgets for displaying performance information using dials, gauges, bars and charts.

Power Gadgets is actually a commercial product (www.powergadgets.com), but you can download a free trial. Normally, Mr. Roboto prefers to offer up his own work or free solutions, but the licensing costs for Power Gadgets are very reasonable. Even a small business should be able to justify the cost, given the value. Let me illustrate -- literally.

Figure 1
[Click on image for larger view.]
Figure 1. This Power Gadgets graph gives you a quick look at memory usage.

Suppose I want to monitor disk utilization on one of my servers. In PowerShell, I'd execute an expression like this:

get-wmiobject -query "Select DeviceID,Size,Freespace from Win32_logicaldisk where drivetype=3" computer " DC01"

It works, but I need more power. Here's the same expression, except this time I sent it through Power Gadgets:

get-wmiobject -query "Select DeviceID,Size,Freespace from Win32_logicaldisk where drivetype=3" computer " DC01"| out-chart -values FreeSpace,Size -label DeviceID -title "Disk Utilization Report"

Now I have a terrific visual representation of disk utilization. I can even instruct the Out-Chart cmdlet to refresh the information at specified intervals. I can leave this chart on my desktop and have it updated as often as I want, even after I close my PowerShell session.

Suppose you want to keep an eye on how much memory your system is currently using. This expression will create a nifty dial gauge:

(get-process | measure-object -property workingset -sum).sum/1mb | out-gauge -floating -refresh 0:0:2 -tooltip "Total Working Set Size"

This gadget will refresh every two seconds and display "Total Working Set Size" when you hover your mouse over the chart. Here's one more for you to try on your own:

Get-wmiobject win32_processor | out-gauge -type digital -value loadpercentage -float -refresh 0:0:5 -tooltip "CPU Load %"

You can also use Power Gadgets to send SMTP mail, create maps, return information from a database and even invoke Web services. And I've only scratched the surface. You aren't restricted to using the existing cmdlets either. You can create your own scripts or functions, and pipe that information to Power Gadgets.

Roboto on Demand

Get some practice with Power Gadgets and PowerShell at www.jdhitsolutions.com/scripts

What Windows admin task would you like Mr. Roboto to automate next? Send your suggestions to [email protected].

All of the Power Gadget cmdlets are highly customizable to a very granular level. To simplify the process, Power Gadgets also comes with a utility where you can create self-contained and customized gadgets. You can have the source data come from a PowerShell expression, a database or a Web service. Once you've created a gadget, you can redistribute the stand-alone files in your network (you'll need to install Power Gadgets) or use them on your own desktop to quickly get the system information you want without having to retype a complex expression or run a PowerShell script.

You could easily create your own network operations center on your desktop with real-time monitors and graphs for just about everything running on your network. There's no need to spend a ton of money on a high-end solution.

About the Author

Jeffery Hicks is an IT veteran with over 25 years of experience, much of it spent as an IT infrastructure consultant specializing in Microsoft server technologies with an emphasis in automation and efficiency. He is a multi-year recipient of the Microsoft MVP Award in Windows PowerShell. He works today as an independent author, trainer and consultant. Jeff has written for numerous online sites and print publications, is a contributing editor at Petri.com, and a frequent speaker at technology conferences and user groups.

Featured

comments powered by Disqus

Subscribe on YouTube

Upcoming Training Events

0 AM
Live! 360 Orlando
November 17-22, 2024
TechMentor @ Microsoft HQ
August 11-15, 2025