diff --git a/src/System.Management.Automation/engine/remoting/common/WireDataFormat/EncodeAndDecode.cs b/src/System.Management.Automation/engine/remoting/common/WireDataFormat/EncodeAndDecode.cs index d99fbe211..aa22e4568 100644 --- a/src/System.Management.Automation/engine/remoting/common/WireDataFormat/EncodeAndDecode.cs +++ b/src/System.Management.Automation/engine/remoting/common/WireDataFormat/EncodeAndDecode.cs @@ -4,6 +4,7 @@ using System.Collections; using System.Collections.Generic; using System.Globalization; +using System.Management.Automation; using System.Management.Automation.Host; using System.Management.Automation.Internal; using System.Management.Automation.Remoting; @@ -73,7 +74,7 @@ namespace System.Management.Automation /// internal static class RemotingConstants { - internal static readonly Version HostVersion = new Version(1, 0, 0, 0); + internal static readonly Version HostVersion = PSVersionInfo.PSVersion; internal static readonly Version ProtocolVersionWin7RC = new Version(2, 0); internal static readonly Version ProtocolVersionWin7RTM = new Version(2, 1); diff --git a/test/powershell/engine/Remoting/RemoteSession.Basic.Tests.ps1 b/test/powershell/engine/Remoting/RemoteSession.Basic.Tests.ps1 index 27d2fceb4..a8054b471 100644 --- a/test/powershell/engine/Remoting/RemoteSession.Basic.Tests.ps1 +++ b/test/powershell/engine/Remoting/RemoteSession.Basic.Tests.ps1 @@ -345,5 +345,16 @@ Describe "Remoting loopback tests" -Tags @('CI', 'RequireAdminOnWindows') { $result = Invoke-Command -Session $openSession -ScriptBlock { $using:number } $result | Should -Be 100 } + + It '$Host.Version should be PSVersion' { + $session = New-RemoteSession -ConfigurationName $endPoint + try { + $result = Invoke-Command -Session $session -ScriptBlock { $Host.Version } + $result | Should -Be $PSVersionTable.PSVersion + } + finally { + $session | Remove-PSSession -ErrorAction Ignore + } + } }