PowerShell Team

Automating the world one-liner at a time…

Set-Alias-Strict

I picked up Jerry Lee Ford's book Microsoft Windows PowerShell Programming for the absolute beginner .  In the section on aliases, he warns users that Set-Alias does not verify the validity of the alias assignment.  That is a good point.  Here is a function that does that for you.  function Set-Alias-Strict($Name, $...

Accessing data past the end of an array

In the newsgroup Microsoft.Public.Windows.PowerShell  Marco Shaw asked about accessing data past the end of a defined array.  He wondered why he didn't get an error.    As a general rule in PowerShell, when you ask for something that doesn't exist, you get an NULL not an error.  PS> $array=@(0,1,2)PS> if...

Sorting out -GroupBy

Did you realize that Format-Table had a parameter -GroupBy?  This tells Format-Table to generate a series of tables instead of a single table.  The best way to get this in focus is to show an example.  For the purposes of this blog entry, I'm going to use the aliases GSV for Get-Service and FT for Format-Table.  Also...

2 + 2 equals "Monday Evening"

I wanted to follow up on Jeffrey's post and one of the comments.  It has to do with this example: The reason that we get a double rather than an int is because of precedence.  The conversion has a higher precedence than the division operation, so what really means is: "Convert 1 to an integer and then divide by 2", which will result...

Two plus two equals "Monday" ?

In PowerShell, two plus two does not always equal four.  Why?  Because there are twos and there are twos. Let me explain.  PowerShell does a ton of work on your behalf so you can think about what you want to do and not how to do it.  Think about the difference between an automatic transmission and a manual ...

Windows PowerShell for Testers

The PowerShell team is very much into unit testing so, when  I ran into this blog by Adam Geras today, I found it very interesting.  All its entries are on using PowerShell for testing.  I especially liked this entry on using PowerShell and Excel for data driven testing because I always love it when you can ...

"PowerShell … is there anything it CAN'T do?"

This weekend my wife was searching for some stuff and came across the following photo on Flickr : http://www.flickr.com/photos/windbag/167080724/  Apparently someone had taken a photo of the one of the slides during my TechEd talk. I just loved the comment.  This one has a fun comment as well:  http://www.flickr.com/photos/...

Yet Another Freakishly PowerFul PowerShell One-liner

MOW has done it again.  Check out  http://thepowershellguy.com/blogs/posh/archive/2007/01/06/it-is-to-me.aspx for another one of MOW's freakishly powerful PowerShell one-liners.  It is so powerful and pithy that makes my head spin.  Enjoy! Jeffrey Snover [MSFT]Windows PowerShell/MMC ArchitectVisit the Windows ...

Cliff Notes of ConvertTo-Html & Other Language Blogs

I just saw a PowerShell blog entry on spaces ( http://hung-yuwu.spaces.live.com/Blog/cns!744FB258BF8C8020!1291.entry ) but it was in a language I don't read (I think it was Japanese)*.  I thought I would check it out for yucks and was delighted to realizes that while I couldn't understand anything the blogger was saying, I could ...