Support Forums

We are currently experiencing failures on the SAPIEN store and are working hard to rectify the situation. In the meantime, please DO NOT place an order through the store. Instead, please contact us directly at sales@sapien.com. We apologize for any inconvenience.

two background jobs colision

Ask your Windows PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.
User avatar
noescape
Posts: 16
Joined: Wed Apr 22, 2015 4:57 am

Re: two background jobs colision

Postby noescape » Wed Jan 13, 2016 6:09 am

jvierra wrote:
noescape wrote:Thanks for useful information, it makes sense. I figured it out myself but I'm glad it was the right place to stop the timer.


Here is how to run a continuous background ping against multiple computers. It will run until you stop the job. You can use a timer to poll the job and display/update the status of the computers. Other tasks can just test the status. I use read only checkboxes to display status and se the color. If checked the computer is online and responding.
workflow pingall  {
param([string[]]$computers)
while(1){
foreach -parallel($c in $computers) {
Test-Connection $c -Count 1
sleep 2
}
}
}
pingall 'omega', 'w8test', 'alpha'
pingall 'omega', 'w8test', 'alpha' -asjob -JobName PingAll



Perfect, I was experimenting with parallel workflow before but couldn't get it to update my form controls correctly. In my form I also use a datagridview with readonly checkbox column to display status of queried stations so that should be easy to set up.
Thanks a lot for this piece of code.

Regards,

Thomas

Return to “Windows PowerShell”

Who is online

Users browsing this forum: No registered users and 3 guests