|
57 | 57 | # Ignore all output from Get-PSFRunspace - it'll be handled by the second loop
|
58 | 58 | if ($item -eq "psframework.runspace.runspacecontainer") { continue }
|
59 | 59 |
|
60 |
| - if ([PSFramework.Runspace.RunspaceHost]::Runspaces.ContainsKey($item.ToLower())) |
| 60 | + if ([PSFramework.Runspace.RunspaceHost]::Runspaces.ContainsKey($item)) |
61 | 61 | {
|
62 | 62 | if ($PSCmdlet.ShouldProcess($item, "Starting Runspace"))
|
63 | 63 | {
|
64 | 64 | try
|
65 | 65 | {
|
66 |
| - if (-not $NoMessage) { Write-PSFMessage -Level Verbose -Message "Starting runspace: <c='em'>$($item.ToLower())</c>" -Target $item.ToLower() -Tag "runspace", "start" } |
67 |
| - [PSFramework.Runspace.RunspaceHost]::Runspaces[$item.ToLower()].Start() |
| 66 | + if (-not $NoMessage) { Write-PSFMessage -Level Verbose -Message "Starting runspace: <c='em'>$($item)</c>" -Target $item -Tag "runspace", "start" } |
| 67 | + [PSFramework.Runspace.RunspaceHost]::Runspaces[$item.].Start() |
68 | 68 | }
|
69 | 69 | catch
|
70 | 70 | {
|
71 |
| - Stop-PSFFunction -Message "Failed to start runspace: <c='em'>$($item.ToLower())</c>" -ErrorRecord $_ -EnableException $EnableException -Tag "fail", "argument", "runspace", "start" -Target $item.ToLower() -Continue |
| 71 | + Stop-PSFFunction -Message "Failed to start runspace: <c='em'>$($item)</c>" -ErrorRecord $_ -EnableException $EnableException -Tag "fail", "argument", "runspace", "start" -Target $item -Continue |
72 | 72 | }
|
73 | 73 | }
|
74 | 74 | }
|
75 | 75 | else
|
76 | 76 | {
|
77 |
| - Stop-PSFFunction -Message "Failed to start runspace: <c='em'>$($item.ToLower())</c> | No runspace registered under this name!" -EnableException $EnableException -Category InvalidArgument -Tag "fail", "argument", "runspace", "start" -Target $item.ToLower() -Continue |
| 77 | + Stop-PSFFunction -Message "Failed to start runspace: <c='em'>$($item)</c> | No runspace registered under this name!" -EnableException $EnableException -Category InvalidArgument -Tag "fail", "argument", "runspace", "start" -Target $item -Continue |
78 | 78 | }
|
79 | 79 | }
|
80 | 80 |
|
|
84 | 84 | {
|
85 | 85 | try
|
86 | 86 | {
|
87 |
| - if (-not $NoMessage) { Write-PSFMessage -Level Verbose -Message "Starting runspace: <c='em'>$($item.Name.ToLower())</c>" -Target $item -Tag "runspace", "start" } |
| 87 | + if (-not $NoMessage) { Write-PSFMessage -Level Verbose -Message "Starting runspace: <c='em'>$($item.Name)</c>" -Target $item -Tag "runspace", "start" } |
88 | 88 | $item.Start()
|
89 | 89 | }
|
90 | 90 | catch
|
91 | 91 | {
|
92 |
| - Stop-PSFFunction -Message "Failed to start runspace: <c='em'>$($item.Name.ToLower())</c>" -EnableException $EnableException -Tag "fail", "argument", "runspace", "start" -Target $item -Continue |
| 92 | + Stop-PSFFunction -Message "Failed to start runspace: <c='em'>$($item.Name)</c>" -EnableException $EnableException -Tag "fail", "argument", "runspace", "start" -Target $item -Continue |
93 | 93 | }
|
94 | 94 | }
|
95 | 95 | }
|
|
0 commit comments