PowerShell script exchange
Post Reply
cseeliger
Service Provider
Posts: 5
Liked: 1 time
Joined: May 02, 2017 9:59 am
Full Name: Christoph Seeliger
Contact:

FeatureRequest: Change version check in Powershell Module

Post by cseeliger » 1 person likes this post

Hi Veeam team,

could you change the powershell version check in your powershell module so that it uses $PSVersionTable.PSVersion instead of $host.version?

There are some posts in this forum that reflect this problem when using a powershell remote session, where a warning is displayed, that powershell v1 was detected. The same behaviour occurs when using Visual Studio Code and running scripts in the integrated PS console, because $host.version reflects the version of Visual Studio Code Powershell Extension while $PSVersionTable.PSVersion reflects the Powershell version itself:

Code: Select all

PS C:\Users\seeligch> Connect-VBRServer -Server veeam
WARNING: You should update your PowerShell to PowerShell 2.0 version.
PS C:\Users\seeligch> $host.version

Major  Minor  Build  Revision
-----  -----  -----  --------
1      6      0      -1


PS C:\Users\seeligch> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      14409  1012
Best regards
Christoph
Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests