![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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 |
| | #1 (permalink) |
| Guest | is it possible to create async processes? Hi, Is is possible to create async processes in Powershell via WMI or .NET? If so, can someone give an example? I would like to spawn off Powershell scripts at the same time to gather performance information from various hosts. I have the PS scripts written for gathering this data but I just need to spawn them at the same time for comparison purposes. thanks in advance, Frank |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: is it possible to create async processes? On Apr 11, 7:48 pm, Frank <F...@discussions.microsoft.com> wrote: > Hi, > > Is is possible to create async processes in Powershell via WMI or .NET? If > so, can someone give an example? I would like to spawn off Powershell > scripts at the same time to gather performance information from various > hosts. I have the PS scripts written for gathering this data but I just need > to spawn them at the same time for comparison purposes. > > thanks in advance, > > Frank I'm going to stick my neck out here and say that you're options may be limited, if only because Powershell itself is single-process single- threaded. However there's always Start-Process which would be asynchronous in as much as control will pass back to the calling powershell session as soon as the child-process is started. Then maybe you can watch/poll/monitor the file-system for results? Regards, Duncan. |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: is it possible to create async processes? I don't see Start-Process as any command or cmdlet? "Duncan Smith" wrote: > On Apr 11, 7:48 pm, Frank <F...@discussions.microsoft.com> wrote: > > Hi, > > > > Is is possible to create async processes in Powershell via WMI or .NET? If > > so, can someone give an example? I would like to spawn off Powershell > > scripts at the same time to gather performance information from various > > hosts. I have the PS scripts written for gathering this data but I just need > > to spawn them at the same time for comparison purposes. > > > > thanks in advance, > > > > Frank > > I'm going to stick my neck out here and say that you're options may be > limited, if only because Powershell itself is single-process single- > threaded. However there's always Start-Process which would be > asynchronous in as much as control will pass back to the calling > powershell session as soon as the child-process is started. Then > maybe you can watch/poll/monitor the file-system for results? > > Regards, > > Duncan. > > |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: is it possible to create async processes? One easy way in this case is just start multiple powershell.exe's. powershell -noexit "script.ps1" powershell -noexit "script2.ps1" .... You could also write a cmdlet and do some threading stuff with multiple runspaces I guess and gather results. -- William Stacey [C# MVP] PCR concurrency library: www.codeplex.com/pcr PSH Scripts Project www.codeplex.com/psobject "Frank" <Frank@discussions.microsoft.com> wrote in message news:E04F3814-CCCC-4A7C-8FD2-818D913A7AD0@microsoft.com... | Hi, | | Is is possible to create async processes in Powershell via WMI or .NET? If | so, can someone give an example? I would like to spawn off Powershell | scripts at the same time to gather performance information from various | hosts. I have the PS scripts written for gathering this data but I just need | to spawn them at the same time for comparison purposes. | | thanks in advance, | | Frank | |
My System Specs![]() |
| | #5 (permalink) |
| Guest | Re: is it possible to create async processes? "Frank" <Frank@discussions.microsoft.com> wrote in message news:B32BFACF-6195-4B83-B03E-234C46723536@microsoft.com... >I don't see Start-Process as any command or cmdlet? Start-Process is part of the PowerShell community extensions. See: http://www.codeplex.com/PowerShellCX > > > > "Duncan Smith" wrote: > >> On Apr 11, 7:48 pm, Frank <F...@discussions.microsoft.com> wrote: >> > Hi, >> > >> > Is is possible to create async processes in Powershell via WMI or .NET? >> > If >> > so, can someone give an example? I would like to spawn off Powershell >> > scripts at the same time to gather performance information from various >> > hosts. I have the PS scripts written for gathering this data but I >> > just need >> > to spawn them at the same time for comparison purposes. >> > >> > thanks in advance, >> > >> > Frank >> >> I'm going to stick my neck out here and say that you're options may be >> limited, if only because Powershell itself is single-process single- >> threaded. However there's always Start-Process which would be >> asynchronous in as much as control will pass back to the calling >> powershell session as soon as the child-process is started. Then >> maybe you can watch/poll/monitor the file-system for results? >> >> Regards, >> >> Duncan. >> >> |
My System Specs![]() |
| | #6 (permalink) |
| Guest | Re: is it possible to create async processes? Frank wrote: > Hi, > > Is is possible to create async processes in Powershell via WMI or .NET? If > so, can someone give an example? I would like to spawn off Powershell > scripts at the same time to gather performance information from various > hosts. I have the PS scripts written for gathering this data but I just need > to spawn them at the same time for comparison purposes. > > thanks in advance, > > Frank > I'm not exactly a Powershell guru, in fact, I know very little about it, however I am aware that it is built on .NET. I am wondering if you could create a .NET delegate and call your Powershell function through the delegate? Delegates are asynchronous and spawn off their own threads, so theoretically, this would solve that issue. A while back, I actually wrote a small, multi-threaded .NET app that used delegates to get information from remote systems for the same purpose. My guess is that Powershell ought to be able to do the same thing. Trevor |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Design for async call | Fred | .NET General | 0 | 06-10-2008 03:56 AM |