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

is it possible to create async processes?

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 04-11-2007   #1 (permalink)
Frank
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 SpecsSystem Spec
Old 04-11-2007   #2 (permalink)
Duncan Smith
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 SpecsSystem Spec
Old 04-11-2007   #3 (permalink)
Frank
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 SpecsSystem Spec
Old 04-11-2007   #4 (permalink)
William Stacey [C# MVP]
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 SpecsSystem Spec
Old 04-11-2007   #5 (permalink)
John Vottero
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 SpecsSystem Spec
Old 04-16-2007   #6 (permalink)
Trevor Sullivan
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 SpecsSystem Spec
Closed Thread

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


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