TECH_GUY_MC
asked on
Running PSEXEC under parallel processing Fail
I am running the following PSEXEC code and this works fine if I run it serially in a normal powershell script loop.
c:\scripts\message\psexec. exe -s -i -d \\$_ wscript.exe "\\server\share\myscript.v bs" /message:"****A Message****"
When I try running it as a parallel processed task, I get the following message
PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com
The handle is invalid.
Connecting to ...Couldn't access :
Connecting to ...
+ CategoryInfo : NotSpecified: (:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com
The handle is invalid.
Connecting to ...Couldn't access :
Connecting to ...
Below is my Code for the Parallel processed task.
# Loop through the server list
Get-Content "computers.txt" | %{
# Define what each job does
$ScriptBlock = {
c:\scripts\message\psexec. exe -s -i -d \\$_ wscript.exe "\\server\share\myscript.v bs" /message:"****A Message****"
Start-Sleep 15
}
# Execute the jobs in parallel
Start-Job $ScriptBlock
}
Get-Job
# Wait for it all to complete
While (Get-Job -State "Running")
{
Start-Sleep 10
}
# Getting the information back from the jobs
Get-Job | Receive-Job
c:\scripts\message\psexec.
When I try running it as a parallel processed task, I get the following message
PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com
The handle is invalid.
Connecting to ...Couldn't access :
Connecting to ...
+ CategoryInfo : NotSpecified: (:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com
The handle is invalid.
Connecting to ...Couldn't access :
Connecting to ...
Below is my Code for the Parallel processed task.
# Loop through the server list
Get-Content "computers.txt" | %{
# Define what each job does
$ScriptBlock = {
c:\scripts\message\psexec.
Start-Sleep 15
}
# Execute the jobs in parallel
Start-Job $ScriptBlock
}
Get-Job
# Wait for it all to complete
While (Get-Job -State "Running")
{
Start-Sleep 10
}
# Getting the information back from the jobs
Get-Job | Receive-Job
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
get-job | wait-job