Powershell code runs synchronously. This means that one line is processed at a time until the end of the script is reached. This is fine for most scripts but there will be situations where this type of execution is not ideal. A port scanner for example would take forever if it ran synchronously. When creating…
Tag: jobs
Powershell tutorial, Jobs part 2
Here is a Ping sweeper script using Powershell jobs to speed things up. The script works (at a high level) like this: I create an array of IP addresses to scan. I loop through each IP If I am running the max number of concurrent jobs, wait for some jobs to finish, add the results…