PowerShell tricks

Soo… PowerShell seriously rocks! I just downloaded the 1.0 release for Vista today and was playing around with it. Here’re my top 2 features in the couple of hours that I’ve been playing with it…

Cool feature #1: You have the entire .net framework at your disposal from the command line. So, you can instantiate any .net class and call methods on it with no compiler or anything.

Cool feature #2: It natively understands xml. Which means that you can get an xml blob and play around with it at the command line.

Combine the two together and what do you get?

A shell script that prints out the latest woot.com sale item and price:

PS C:Usersumeshu> ([xml] (new-object System.Net.WebClient).DownloadString(“http://www.woot.com/Blog/Rss.aspx”)).rss.channel.item[0].title

Philips GoGear 2GB MP3 Player w/ FM Tuner – $49.99

Or how about the latest headlines from Slashdot:

PS C:Usersumeshu> ([xml] (new-object System.Net.WebClient).DownloadString(“http://rss.slashdot.org/Slashdot/slashdot”)).RDF.Item| select title

Brain Scanner Can Read People’s Intentions

Is Interoperable DRM Really Less Secure?

MIT’s Millimeter Turbine to be Ready This Year

Microsoft Not Dropping Hotmail Name

Mice Cured of Autism

Cisco to Open Source CTA

Windows Expert Jumps Ship

University Professor Chastised For Using Tor

FAA To Free Aircraft Hobbled By IP Laws

Apple’s Windows Apps Not Ready For Vista

Yahoo Pipes

Canonical and Linspire Make a Deal

Indonesia Stops Sharing Avian Virus Samples

Did Gates Fib About H1-B Salaries?

To Media Companies, BitTorrent Implies Guilt

Neat, huh 🙂 More to follow in the weeks ahead I suppose…

PS: Holy @!%*&, it’s been over two months since I last blogged! There’s been too much happening in life and work over the past few months that’s kept me busy, but I hope to blog more frequently in the New Year.

Leave a Reply

Your email address will not be published. Required fields are marked *