8000 Update `ServerRemoteHost` Version to be same as `PSVersion` by SteveL-MSFT · Pull Request #15809 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Update ServerRemoteHost Version to be same as PSVersion #15809

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -73,7 +74,7 @@ public RemotingEncodingException(string message, Exception innerException, Error
/// </summary>
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);
Expand Down
11 changes: 11 additions & 0 deletions test/powershell/engine/Remoting/RemoteSession.Basic.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

0