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
Christoph