PowerShell Team

Automating the world one-liner at a time…

Software Inventory

Otto Helweg has started a blog called Management Matters that I think you'll enjoy. He just posted an entry about how to use PSINFO (from SysInternals) and PowerShell to do a quick and dirty software inventory and displaying the results to a screen or storing them in a database. Give it a read – it's cool stuff.  Jeffrey Snover [MSFT]...

Internet Radio Function

I found a cool blog entry at http://hung-yuwu.spaces.live.com/Blog/cns!744FB258BF8C8020!1377.entry . I have no idea what it says but I can read the script and I like it. The person has an internet radio site that they like and wrote a simple script to get run it in an IE windows with a fixed size and location and without all the IE adornments...

Functions vs Filters

In my previous entry, I referred to Rsbohn's blog PowerShell $Profile and his function to slow down output function slowly ($tempo=100) { process { $_; Start-Sleep -milliseconds $tempo}} This is a good candidate for a FILTER. A filter is function that just has a process scriptblock. So you could have written his as: filter slowly ($tempo=...

Start-Demo: Help doing demos using PowerShell

A couple a weeks ago I got a call from BillG's Technical Assistant (TA) telling me that Bill and Ray (Ozzie) wanted to get a demo of the new stuff we were doing with PowerShell. The setting was Bill's conference room that would be organized with a number of Demo stations. You'd get called in and were allowed to bring one other person but then ...

Improved PowerShell grammar Documentation

Bruce Payette is a co-designer of the PowerShell language and the development lead for its implementation. From that, you might guess that his book: Windows PowerShell in Action would provide a great explanation of the language and how to use it – you'd be right. In the past, we've posted a PowerShell grammar document but a number of you ...

Year of the Pig Revisited – the magic of QL

Richard Siddaway has a blog entry showing how to calculate the Chinese Horoscope using PowerShell. His solution uses hashtables: ## create hash table $years = @{1="Rat"; 2="Ox"; 3="Tiger"; 4="Rabbit"; 5="Dragon"; 6="Snake";            7="Horse"; 8="Goat"; 9="Monkey"; 10="Rooster"; 11="Dog"; 0="Pig"} ## get the year of...

Pause

In the Newsgroup Microsoft.Public.Windows.PowerShell, BJ Stigall asked what the equivalent of the batch file PAUSE function was in PowerShell. There were lots of good answers that came close but I think the one below comes the closest (and a little bit better). function Pause ($Message="Press any key to continue..."){Write-Host -NoNewLine $...

Supporting -Whatif, -Confirm, -Verbose – In SCRIPTS!

<This is a super-important issue so you should definitely start using this in your scripts that you share with others (that have side effects on the system). Please try it out and blog about it to others so that it becomes a community norm. Thanks-jps> One of the greatest things about PowerShell is that when you use a Cmdlet which is ...

NetBeans IDE support for PowerShell

Apparently one of the main themes of NetBeans 6.0 is going to be support for scripting languages (yet another indication of the industry wide ascendency of Scripting. It is a VERY good time to embrace scripting or "learn PowerShell and increase your integrated lifetime earnings" J). HERE is a blog entry of someone that added PowerShell ...

Displaying USB Devices using WMI

Over on MyItForum.com, I came upon a VBScript in a forum to find all the PNP entities associated with a USBController. I rewrote it in PowerShell and was pretty happy with the results so I thought I would share them. The first thing you need to understand is that the WMI class WIN32_USBControllerDevice describes the connection between USB ...