powershell - New-PSSession in Job blocks Job -
powershell - New-PSSession in Job blocks Job -
i need start pssession in job. can't utilize invoke-command -asjob due product architecure.
i tried like:
$block { "job started" $session = new-pssession -computername "host-name" "session started" } $job = start-job -scriptblock $block wait-job -job $job -timeout 10 | out-null receive-job -job $job
(i don't have ps on scheme post question, create error in syntax, skip it, please)
but, instead of creating remote session job became blocked forever on new-pssession line. wait-job exit timeout, , recieve-job homecoming "job started".
i tried:
i ensure remoting in main thread working well, , invoke-command -asjob working too. invoke-command , other pssession-based cmdlets have same behavior — blocks job execution.create pssession in main thread , transfer session object or object.id -inputarguments job
result: pssession created in main thread can't used in kid job, no matter, transfered or found within job`s scriptblock get-pssession
thanks in advance!
powershell remoting
Comments
Post a Comment