Get-PSVersion


posted by Aleksandar
05-31-2009

Downloads: 2,444
File size: 285 B
Views: 13,633

Embed
Get-PSVersion
  1. # If the $PSVersionTable variable doesn't exist, then you are running V1. 
  2. # If it does exist, then the version will be available as $PSVersionTable.PSVersion. 
  3.  
  4. function Get-PSVersion
  5.     if (test-path variable:psversiontable) {$psversiontable.psversion} else {[version]"1.0.0.0"
Filed under: , ,
How do you check which version of PowerShell you are using? If the $PSVersionTable variable doesn't exist, then you are running V1. If it does exist, then the version will be available as $PSVersionTable.PSVersion.

Comments

DrDOS wrote re: Get-PSVersion
on 04-09-2013 5:37 AM

powershell.com/.../2617.aspx

Does this go in a ps1 or cmd file?  Just getting my feet wet.

Thanks.

Aleksandar wrote re: Get-PSVersion
on 04-09-2013 9:23 PM

yes, you can put this is .ps1 file.

Copyright 2012 PowerShell.com. All rights reserved.