If you are running Windows 7 and have not yet upgraded to PowerShell 3, do it now. The installation files are here. I use Output-GridView all the time, and PS3 cuts the DCOM strings. Here is an article that explains the changes from PS2 for both versions, and another that describes the version 3 changes.. I am going to try to remember version dependencies in later scripts; an easy PowerShell version check is below.
$reqVer = 3
if ((get-host).version.major -lt $reqVer) {
Write-Error "This script requires Powershell $reqVer or later."
pause
Exit-PSSession
}
PowerShell 4 has been recently released, but I have not installed it yet. Although I don’t want to write scripts that require an PowerShell update to run, I have decided that I will be relying on PS 3 features for my scripts.
Update 8-3-13. I learned in my PowerShell user group that there is a much easier way to do the version check. Instead of the code above use:
#Requires -version 3
.
#Requires is supported from PS 1.0 to PS 4.0. To learn more about it, read about_Requires.