![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #2 (permalink) |
| Guest | Re: Terminate Script Execution? I've had similar issues with poorly-behaved objects. What's it hanging on? There may be a way to work around this with the specific object. "MKielman" <mkielman@newsgroups.nospam> wrote in message news:OiIrXJU7GHA.1252@TK2MSFTNGP04.phx.gbl... >I am trying to use ctrl+c to terminate a script but nothing happens. So far >I have only been able to close the command shell in order to get a script >to stop executing. |
| | #3 (permalink) |
| Guest | Re: Terminate Script Execution? it depends on what your script is doing, specifically, if you're in the middle of a .NET Method call, CTRL-C won't take effect until the next script line. Can you be more specific about what you're trying to do? -- -- James Truher [MSFT] Windows PowerShell Development Microsoft Corporation This posting is provided "AS IS" with no warranties, and confers no rights. "MKielman" <mkielman@newsgroups.nospam> wrote in message news:OiIrXJU7GHA.1252@TK2MSFTNGP04.phx.gbl... >I am trying to use ctrl+c to terminate a script but nothing happens. So far >I have only been able to close the command shell in order to get a script >to stop executing. |
| | #4 (permalink) |
| Guest | Re: Terminate Script Execution? My script uses the get-wmiobject using the Win32_QuickFixEngineering and Win32_OperatingSystem classes. I am reading text file that has a list of about 300 servers and I am querying those WMI objects for each server in a foreach loop. When I encounter a problem and I want to stop the script from executing nothing seems to work except for closing the shell which is a pain. James Truher wrote: > it depends on what your script is doing, specifically, if you're in the > middle of a .NET Method call, CTRL-C won't take effect until the next script > line. Can you be more specific about what you're trying to do? > |
| | #5 (permalink) |
| Guest | Re: Terminate Script Execution? My script uses the get-wmiobject using the Win32_QuickFixEngineering and Win32_OperatingSystem classes. I am reading text file that has a list of about 300 servers and I am querying those WMI objects for each server in a foreach loop. When I encounter a problem and I want to stop the script from executing nothing seems to work except for closing the shell which is a pain. James Truher wrote: > it depends on what your script is doing, specifically, if you're in the > middle of a .NET Method call, CTRL-C won't take effect until the next script > line. Can you be more specific about what you're trying to do? > |
| | #6 (permalink) |
| Guest | Re: Terminate Script Execution? Could you show your example code? You might be timing out when attempting to connect to a system. To determine exactly where the problem crops up, you might also include some verbose statements within the script so you know approximately where you are in the code when you can't break out. "MKielman" <mkielman@newsgroups.nospam> wrote in message news:e0pgIrW7GHA.3836@TK2MSFTNGP02.phx.gbl... > My script uses the get-wmiobject using the Win32_QuickFixEngineering and > Win32_OperatingSystem classes. I am reading text file that has a list of > about 300 servers and I am querying those WMI objects for each server in a > foreach loop. When I encounter a problem and I want to stop the script > from executing nothing seems to work except for closing the shell which is > a pain. > > James Truher wrote: >> it depends on what your script is doing, specifically, if you're in the >> middle of a .NET Method call, CTRL-C won't take effect until the next >> script line. Can you be more specific about what you're trying to do? >> |
| | #7 (permalink) |
| Guest | Re: Terminate Script Execution? You are all missing the point. I simply want to terminate a script while it is running no matter what it is doing. The script itself is not hung, it just takes a long time to finish because it is reading a file and performing a task using each line of input. Basically, I am sitting at the shell and have run ./script.ps1. The script is running and printing output to the screen but I want to stop it. On a Unix shell I can use ctrl+c to cancel what the shell is currently running. Alex K. Angelopoulos [MVP] wrote: > Could you show your example code? > > You might be timing out when attempting to connect to a system. To determine > exactly where the problem crops up, you might also include some verbose > statements within the script so you know approximately where you are in the > code when you can't break out. > > > "MKielman" <mkielman@newsgroups.nospam> wrote in message > news:e0pgIrW7GHA.3836@TK2MSFTNGP02.phx.gbl... >> My script uses the get-wmiobject using the Win32_QuickFixEngineering and >> Win32_OperatingSystem classes. I am reading text file that has a list of >> about 300 servers and I am querying those WMI objects for each server in a >> foreach loop. When I encounter a problem and I want to stop the script >> from executing nothing seems to work except for closing the shell which is >> a pain. >> >> James Truher wrote: >>> it depends on what your script is doing, specifically, if you're in the >>> middle of a .NET Method call, CTRL-C won't take effect until the next >>> script line. Can you be more specific about what you're trying to do? >>> > > |
| | #9 (permalink) |
| Guest | Re: Terminate Script Execution? "MKielman" <mkielman@newsgroups.nospam> wrote in message news:u$QWouX7GHA.4064@TK2MSFTNGP03.phx.gbl... > You are all missing the point. I simply want to terminate a script while > it is running no matter what it is doing. And since it doesn't "just work" when PS execution is tied to an external process (such as wmiprvse.exe in this case), I was hoping to find out where in the cycle the script is choking. That would give me some ideas about a good bug report for this behavior and possibly point to an interim workaround. > ... The script itself is not hung, Sounds like it would be more accurate to describe this as "PowerShell is not immediately responsive to an attempt to break execution somewhere in the script". I was under the impression that it was hanging because you said that nothing worked - presumably meaning that control never, ever returned to you, no matter how long you waited. What I was really after was enough information to determine where this is happening. If you think this is ugly and nasty compared to Unix process handling, I have to agree with you. ![]() |
| | #10 (permalink) |
| Guest | Re: Terminate Script Execution? Hi, Ctrl+Z sometimes works when Ctrl+C doesn't. I am not entirely clear on why or when. And I don't know if it works "no matter what" a script is doing. Andrew Watt MVP On Wed, 11 Oct 2006 14:24:34 -0700, MKielman <mkielman@newsgroups.nospam> wrote: >You are all missing the point. I simply want to terminate a script while >it is running no matter what it is doing. The script itself is not hung, >it just takes a long time to finish because it is reading a file and >performing a task using each line of input. Basically, I am sitting at >the shell and have run ./script.ps1. The script is running and printing >output to the screen but I want to stop it. On a Unix shell I can use >ctrl+c to cancel what the shell is currently running. > > > >Alex K. Angelopoulos [MVP] wrote: >> Could you show your example code? >> >> You might be timing out when attempting to connect to a system. To determine >> exactly where the problem crops up, you might also include some verbose >> statements within the script so you know approximately where you are in the >> code when you can't break out. >> >> >> "MKielman" <mkielman@newsgroups.nospam> wrote in message >> news:e0pgIrW7GHA.3836@TK2MSFTNGP02.phx.gbl... >>> My script uses the get-wmiobject using the Win32_QuickFixEngineering and >>> Win32_OperatingSystem classes. I am reading text file that has a list of >>> about 300 servers and I am querying those WMI objects for each server in a >>> foreach loop. When I encounter a problem and I want to stop the script >>> from executing nothing seems to work except for closing the shell which is >>> a pain. >>> >>> James Truher wrote: >>>> it depends on what your script is doing, specifically, if you're in the >>>> middle of a .NET Method call, CTRL-C won't take effect until the next >>>> script line. Can you be more specific about what you're trying to do? >>>> >> >> |
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Terminate process issue | Jonathan | VB Script | 3 | 07-02-2008 01:50 PM |
| Re: VMware remote console causing powershell scripts to terminate? | Maximilian Hänel | PowerShell | 6 | 03-11-2008 10:45 AM |
| "background" script execution | David | PowerShell | 16 | 11-06-2007 04:26 PM |
| WMP 11 will not terminate sound | Armin Heinlein | Vista General | 13 | 06-14-2007 09:11 PM |
| Powershell does not terminate when started VBSCRIPT | ktmd | PowerShell | 1 | 05-14-2007 03:35 PM |