Archive for August, 2012

PowerShell Version 3 if..else bug


Consider the following from PowerShell’s excellent help: Get-Help about_If 001002003004005006007008 if ($a -gt 2) {    Write-Host “The value $a is greater than 2.”}else{    Write-Host “The value $a is less than or equal to 2, is not created or is not initialized.” } If you modify that example to tighten it up a bit, and make it look better you can cause the […]

6 Comments

Quick modification of the Compare-Command.ps1 script


I found a few issues with my Compare-Command script, and have resolved them. If you have already downloaded it from TechNet, thanks, and you can just modify the following two lines: Line 72 becomes:$V3Detailed |select -ExpandProperty Parameters |ForEach-Object -Process {$V3Paramaters += (“$($_.Name)=$($_.ParameterType.name)=$($V3ModuleName[0])“)} Line 82, likewise, becomes:$V2Detailed |select -ExpandProperty Parameters |ForEach-Object -Process {$V2Paramaters += (“$($_.Name)=$($_.ParameterType.Split(“.”)[-1])=$($V2ModuleName[0]))”)} While […]

Leave a comment

Quickly compare PowerShell V2 and V3 cmdlets


Recently, I was looking for the difference between the Get-ChildItem cmdlet in Version 2 and Version 3 of Windows PowerShell. Although you can Bing “PowerShell Get-ChildItem v3” and get an accurate listing of the new parameters from TechNet, that’s not true for all cmdlets, so I wrote a quick little script to find the information. […]

Leave a comment