mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix PSVersion parameter version checks and error messages for PowerShell 7 remoting (#16228)
This commit is contained in:
@@ -243,3 +243,16 @@ Describe "Ampersand background test" -Tag "CI","Slow" {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Start-Job with -PSVersion parameter" -Tag "CI" {
|
||||
|
||||
It "Verifies that -PSVersion is not supported except for version 5.1" {
|
||||
{ Start-Job -PSVersion 2.0 } | Should -Throw -ErrorId 'ParameterBindingFailed,Microsoft.PowerShell.Commands.StartJobCommand'
|
||||
}
|
||||
|
||||
It "Verifies that -PSVersion 5.1 runs the job in a version 5.1 PowerShell session" -Skip:(-not $IsWindows) {
|
||||
$version = Start-Job -PSVersion 5.1 -ScriptBlock { $PSVersionTable } | Receive-Job -Wait -AutoRemoveJob
|
||||
$version.PSVersion.Major | Should -Be 5
|
||||
$version.PSVersion.Minor | Should -Be 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -491,13 +491,9 @@ namespace PowershellTestConfigNamespace
|
||||
$Result.Session.UseSharedProcess | Should -Be $UseSharedProcess
|
||||
}
|
||||
|
||||
It "Validate Register-PSSessionConfiguration -PSVersion" {
|
||||
It "Verifies that Register-PSSessionConfiguration -PSVersion parameter is not supported" {
|
||||
|
||||
Register-PSSessionConfiguration -Name $TestSessionConfigName -PSVersion 5.1
|
||||
$Session = Get-PSSessionConfiguration -Name $TestSessionConfigName
|
||||
|
||||
$Session.Name | Should -Be $TestSessionConfigName
|
||||
$Session.PSVersion | Should -BeExactly 5.1
|
||||
{ Register-PSSessionConfiguration -Name $TestSessionConfigName -PSVersion 5.1 } | Should -Throw -ErrorId 'ParameterBindingFailed,Microsoft.PowerShell.Commands.RegisterPSSessionConfigurationCommand'
|
||||
}
|
||||
|
||||
It "Validate Register-PSSessionConfiguration -startupscript parameter" -Pending {
|
||||
@@ -567,13 +563,9 @@ namespace PowershellTestConfigNamespace
|
||||
$Result.Session.UseSharedProcess | Should -Be $UseSharedProcess
|
||||
}
|
||||
|
||||
It "Validate Set-PSSessionConfiguration -PSVersion" {
|
||||
It "Verifies that Set-PSSessionConfiguration -PSVersion parameter is not supported" {
|
||||
|
||||
Set-PSSessionConfiguration -Name $TestSessionConfigName -PSVersion 5.1
|
||||
$Session = (Get-PSSessionConfiguration -Name $TestSessionConfigName)
|
||||
|
||||
$Session.Name | Should -Be $TestSessionConfigName
|
||||
$Session.PSVersion | Should -BeExactly 5.1
|
||||
{ Set-PSSessionConfiguration -Name $TestSessionConfigName -PSVersion 5.1 } | Should -Throw -ErrorId 'ParameterBindingFailed,Microsoft.PowerShell.Commands.SetPSSessionConfigurationCommand'
|
||||
}
|
||||
|
||||
It "Validate Set-PSSessionConfiguration -startupscript parameter" -Pending {
|
||||
|
||||
Reference in New Issue
Block a user