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 jhicks@redmondmag.com.

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 a Microsoft MVP in Windows PowerShell, Microsoft Certified Trainer and an IT veteran with over 20 years of experience, much of it spent as an IT consultant specializing in Microsoft server technologies with an emphasis in automation and efficiency. He works today as an independent author, trainer and consultant. Jeff writes the popular Prof. PowerShell column for MPCMag.com and is a regular contributor to the Petri IT Knowledgebase and 4SysOps. If he isn't writing, then he's most likely recording training videos for companies like TrainSignal or hanging out in the forums at PowerShell.org. Jeff's latest books are Learn PowerShell 3 in a Month of Lunches, Learn PowerShell Toolmaking in a Month of Lunches and PowerShell in Depth: An Administrators Guide. You can keep up with Jeff at his blog http://jdhitsolutions.com/blog, on Twitter at twitter.com/jeffhicks and on Google Plus (http:/gplus.to/JeffHicks)

comments powered by Disqus

Reader Comments:

Add Your Comment Now:

Your Name:(optional)
Your Email:(optional)
Your Location:(optional)
Comment:
Please type the letters/numbers you see above

Redmond Tech Watch

Sign up for our newsletter.

I agree to this site's Privacy Policy.