-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify Wait-RSJob documentation on -Timeout parameter #58
Comments
Thanks for the comment. I can look to tidy up on how -Timeout works in the function. The point of timeout within Wait-RSJob is only to be a blocking call up until either the timeout is reached or all of the jobs are marked as Completed. If the timeout is reached, then it only frees up the console for further use while the rest of the jobs are still running until they complete. |
Okay, my use case was one similar to another discussion posted here in that the job that touches those workstations makes WMI calls and there are a handful of systems out of that population that have a tendency to hang causing the job to never complete. Given that scenario and your explanation, I'm probably thinking of still using the throttle switch on start-rsjob, but not piping that to wait-rsjob but instead having wait-rsjob with the timeout on it's own line, e.g. $AllWorkstations | Start-RSJob -Name 'Inventory' -ScriptBlock $ScriptBlock -FunctionsToLoad Get-Warranty -Throttle 20 Wait-RSJob -ShowProgress -Timeout 60 $Results = Get-RSJob | Receive-RSJob Something like that? |
I'm going to look more into adding a -Timeout parameter with Start-RSJob that would timeout commands. In the mean time, you can achieve a timeout using the Wait-RSJob and then stopping the rest of the jobs by using something like this: Get-RSJob -State Running | Stop-RSJob Keep in mind that using Wait-RSJob called by itself will not do anything; you must use Get-RSJob | Wait-RSJob in order to actually force a blocking call in the console while waiting for the jobs. |
Sounds good Boe, I was able to modify my script as you suggested. The Cheers, Nick On Tue, Feb 2, 2016 at 4:30 PM, Boe Prox notifications@github.com wrote:
|
Documentation updated to better reflect its purpose. |
Has a -Timeout parameter been added as mention on Feb 2 2016? I have a similar situation both with WMI calls and connections to MS SQL Server where the connection just hangs, and it would be really useful to solve this. I've been kicking around trying to use a synchronized hashtable like mentioned here, but I'm not quite fluent enough (yet) in Powershell. |
I'm probably being a bit pedantic, but as a point of documentation it may be worth clarifying the nature of the timeout parameter in the Wait-RSJob function a little more in the context of job throttling. If I've got a process that needs to touch 8000 computers, but I throttle the jobs so that only 20 run a time, was the Wait-RSJob on a per job basis or one timeout globally? From some testing on about 200 computers it seems to be a global countdown but I wasn't sure.
The text was updated successfully, but these errors were encountered: