I'm quite new in powershell. I created a form to monitor a few things. One part is pinging servers. The pinging part gets started by a button which starts a function and loops thru an IP lists. The results gets written in a html file. It works fine so far. But if I want to do something else on the form I can't do because the loop is running. Here is the extraction of the function:
function StartPings
{
for ($i=1; $i -le $end; $i++){
$IP= get-content $IP-list #file with IP's
$IP | ForEach-Object{
$pingResult = test-Connection $_ -count 1 -Quiet
... #creates a string with html table row
}
... #creates the full html file
start-sleep -seconds 60
}
}
How do I have to change the function that it runs in an own process? I'm not sure if it is the right term.