header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left
Jun 3

Written by: Karl Prosser
6/3/2008 10:40 PM

Many people recently have asked how to determine programatically what version of PowerShell their script is running in. Well in version two there is a $psversiontable variable, but this sadly isn't in V1. All is not lost though, as you can write a simple function to return a version object for v1. Below is a quick function that I wrote that I have been using for the last year or so. 

function get-psVersion
{
if ((get-Variable psversiontabl[e]) -eq $null)
{
new-Object system.Version "1.0.0.0"
}
else
{
$psversiontable.psversion
}
}

 

-Karl

Tags:

Your name:
Title:
Comment:
Add Comment    Cancel  
 

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

Blogs
  
Search Blogs
  
Archives
  
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer