Windows Vista Forums
Vista Forums Home Join Vista Forums Webcasts Windows 7 Forum Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Re: Timeouts

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 07-15-2008   #1 (permalink)
Brandon Shell [MVP]
Guest


 

Re: Timeouts

I am not sure that (new-job) would work in this case. The problem is the
Powershell thread is lock waiting for a function to return and unless had
the new-job task wait for x amount of seconds and then send Ctrl-C (which
would be problematic at best) I am not sure how you could achieve the goal
of the OP. That said... if you have any ideas about this Marco, I would be
glad to hear them. This is a constant thorn my side as well.

This would be a great feature, but the problem is the single threaded nature
of Powershell. I think a good suggestion in this case would developement
of a CMDLet that could spawn a new runspace, pass the script block with all
the variables in place and kill the runspace if it takes to long. Ironically,
I don't think that would be hard to develope.

Side Note: The new-job function (which I recommend quite often) is very limited
in what you can use it for.

Brandon Shell
---------------
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject
Quote:
Quote:

>> What I mean is specify that Function XXX can run for maximum 10
>> minutes and then it will fail...
>>
M> I'd say you'd need to background something to check whether your
M> function is still running XX time later.
M>
M> v1:
M> http://jtruher.spaces.live.com/blog/...628D!130.entry
M> v2 CTP1/CTP2:
M> *-psjob cmdlets
M> Marco
M>



My System SpecsSystem Spec
Old 07-15-2008   #2 (permalink)
Martin Zugec
Guest


 

Re: Timeouts

Hehe, Citrix scripters and their problems

Exactly, I was thinking about New-Job, but it wouldn't help me in this case


I don't expect something similar exists, however you never know, so I rather
asked...

Martin

"Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
news:29d4f64665478cab4792f3567d8@xxxxxx
Quote:

>I am not sure that (new-job) would work in this case. The problem is the
>Powershell thread is lock waiting for a function to return and unless had
>the new-job task wait for x amount of seconds and then send Ctrl-C (which
>would be problematic at best) I am not sure how you could achieve the goal
>of the OP. That said... if you have any ideas about this Marco, I would be
>glad to hear them. This is a constant thorn my side as well.
>
> This would be a great feature, but the problem is the single threaded
> nature of Powershell. I think a good suggestion in this case would
> developement of a CMDLet that could spawn a new runspace, pass the script
> block with all the variables in place and kill the runspace if it takes to
> long. Ironically, I don't think that would be hard to develope.
>
> Side Note: The new-job function (which I recommend quite often) is very
> limited in what you can use it for.
> Brandon Shell
> ---------------
> Blog: http://www.bsonposh.com/
> PSH Scripts Project: www.codeplex.com/psobject
>
Quote:
Quote:

>>> What I mean is specify that Function XXX can run for maximum 10
>>> minutes and then it will fail...
>>>
> M> I'd say you'd need to background something to check whether your
> M> function is still running XX time later.
> M> M> v1:
> M> http://jtruher.spaces.live.com/blog/...628D!130.entry
> M> v2 CTP1/CTP2:
> M> *-psjob cmdlets
> M> Marco
> M>
>
My System SpecsSystem Spec
Old 07-15-2008   #3 (permalink)
Brandon Shell [MVP]
Guest


 

Re: Timeouts

In the case of CMDLet... the CMDLet would be the bridge. It starts the runspace,
runs the code, and returns the objects as it normally would.

Brandon Shell
---------------
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject
Quote:
Quote:

>> This would be a great feature, but the problem is the single threaded
>> nature of Powershell. I think a good suggestion in this case would
>> developement of a CMDLet that could spawn a new runspace, pass the
>> script block with all the variables in place and kill the runspace if
>> it takes to long. Ironically, I don't think that would be hard to
>> develope.
>>
M> You're right... I didn't think about this hard enough. If you use a
M> new runspace, however you might use one, then you have two generally
M> disconnected runspaces, and you may not be able to pass your objects
M> between each.
M>
M> Tough one...
M>
M> Marco
M>


My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Timeouts Martin Zugec PowerShell 0 07-15-2008 08:01 AM
How to change Vista notification Timeouts?? ryan42 Vista General 0 03-22-2007 09:17 PM
internet connection timeouts Invent Vista networking & sharing 3 09-09-2006 12:08 AM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51