File tree 3 files changed +7
-5
lines changed
3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -2903,12 +2903,13 @@ function New-LabPSSession
2903
2903
}
2904
2904
elseif ($internalSession.Count -ne 0 )
2905
2905
{
2906
- $sessionsToRemove = $internalSession | Select-Object - Skip $ (Get-LabConfigurationItem - Name MaxPSSessionsPerVM)
2906
+ $sessionsToRemove = $internalSession | Select-Object - Skip (Get-LabConfigurationItem - Name MaxPSSessionsPerVM)
2907
2907
Write-PSFMessage " Found orphaned sessions. Removing $ ( $sessionsToRemove.Count ) sessions: $ ( $sessionsToRemove.Name -join ' , ' ) "
2908
2908
$sessionsToRemove | Remove-PSSession
2909
2909
2910
2910
Write-PSFMessage " Session $ ( $internalSession [0 ].Name) is available and will be reused"
2911
- $sessions += $internalSession | Where-Object State -eq ' Opened' | Select-Object - First 1
2911
+ # Replaced Select-Object with array indexing because of https://github.com/PowerShell/PowerShell/issues/9185
2912
+ ($sessions += $internalSession | Where-Object State -eq ' Opened' )[0 ] # | Select-Object -First 1
2912
2913
}
2913
2914
}
2914
2915
@@ -3228,7 +3229,7 @@ function Invoke-LabCommand
3228
3229
# required to suppress verbose messages, warnings and errors
3229
3230
Get-CallerPreference - Cmdlet $PSCmdlet - SessionState $ExecutionContext.SessionState
3230
3231
3231
- if (-not (Get-LabVm - IncludeLinux))
3232
+ if (-not (Get-LabVM - IncludeLinux))
3232
3233
{
3233
3234
Write-LogFunctionExitWithError - Message ' No machine definitions imported, so there is nothing to do. Please use Import-Lab first'
3234
3235
return
Original file line number Diff line number Diff line change @@ -222,7 +222,7 @@ function Invoke-LWCommand
222
222
223
223
if ($AsJob )
224
224
{
225
- $job = Invoke-Command @parameters - ErrorAction SilentlyContinue - ErrorVariable invokeError
225
+ $job = Invoke-Command @parameters - ErrorAction SilentlyContinue
226
226
}
227
227
else
228
228
{
Original file line number Diff line number Diff line change @@ -494,7 +494,8 @@ function Write-ScreenInfo
494
494
495
495
$newSize = ($Global :taskStart ).Length - 1
496
496
if ($newSize -lt 0 ) { $newSize = 0 }
497
- $Global :taskStart = $Global :taskStart | Select-Object - first (($Global :taskStart ).Length - 1 )
497
+ # Replaced Select-Object with array indexing because of https://github.com/PowerShell/PowerShell/issues/9185
498
+ $Global :taskStart = $Global :taskStart [0 .. (($Global :taskStart ).Length - 1 )] # $Global:taskStart | Select-Object -First (($Global:taskStart).Length - 1)
498
499
}
499
500
500
501
You can’t perform that action at this time.
0 commit comments