Get-host version

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
lvl1bsm
Posts: 1
Joined: Fri Jan 04, 2013 7:04 am

Get-host version

Post by lvl1bsm » Mon Nov 11, 2019 7:09 am

In a powershell window I type get-host | select version and get 5.1.17763.592 If i use the same command in a script created by powershell studio I get a different version (3.0). Why is this and how can i write a script with powershell studio that pulls the local machines powershell version?

Powershell Stuidio 2019
5.6.167 64bit
Oerating system:
Windows 10 64bit

*** Please add details and screenshots as needed below. ***

DO NOT POST SUBSCRIPTIONS, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM

User avatar
Alexander Riedel
Posts: 7122
Joined: Tue May 29, 2007 4:43 pm

Re: Get-host version

Post by Alexander Riedel » Mon Nov 11, 2019 11:40 am

The host version is not the same as the Powershell version. SAPIEN Powershell hosts have their own version numbering, so can other hosts.
The proper way to query for the actual PowerShell version is to use $psversiontable.
Alexander Riedel
SAPIEN Technologies, Inc.