![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | 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) |
| | 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) |
| | 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) |
| | 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) |
| | 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) |
| | 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 | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| RAS ASYNC Adapter? | Network & Sharing | |||
| Design for async call | .NET General | |||