Windows Vista Forums

Powershell fork()?
  1. #1


    MKielman Guest

    Powershell fork()?

    Does powershell have the ability to fork? The reason I ask is b/c I
    would like to write a script that pings systems before performing an
    action. I noticed that the shell allows you to run ping but wanted to
    find out how I could incorporate that into my script.



    Thanks

      My System SpecsSystem Spec

  2. #2


    dreeschkind Guest

    RE: Powershell fork()?

    $result = ping www.microsoft.de

    --
    greetings
    dreeschkind

    "MKielman" wrote:

    > Does powershell have the ability to fork? The reason I ask is b/c I
    > would like to write a script that pings systems before performing an
    > action. I noticed that the shell allows you to run ping but wanted to
    > find out how I could incorporate that into my script.
    >
    > Thanks
    >


      My System SpecsSystem Spec

  3. #3


    Andrew Watt [MVP] Guest

    Re: Powershell fork()?

    On Thu, 12 Oct 2006 11:37:01 -0700, MKielman
    <mkielman@newsgroups.nospam> wrote:

    >Does powershell have the ability to fork? The reason I ask is b/c I
    >would like to write a script that pings systems before performing an
    >action. I noticed that the shell allows you to run ping but wanted to
    >find out how I could incorporate that into my script.
    >
    >Thanks


    Hi,

    I'm not totally sure that this is what you are asking but ...

    Type

    get-help about_if

    Does that do what you want?

    Andrew Watt MVP

      My System SpecsSystem Spec

  4. #4


    klumsy@xtra.co.nz Guest

    Re: Powershell fork()?

    forking starts another process, typically everything in powershell is
    done inside one process.. so you can't fork so much.. HOWEVER you can
    start another powershell instance from your script and have it exectue
    some commands, this is akin to forking in some manners

    i.e in powershell do this

    powershell { dir }

    That is screating a new instance of powershell running the command, and
    also marshelling the results back to the powershell instance you called
    it from. notice that the though the results seem to be the same, its
    not a live process object, the results from dir, were serialised then
    reassembled in some sort of pscustomer property bag..

    i.e compare this

    (dir)[0]

    TypeName: System.IO.DirectoryInfo

    with

    (powershell { dir })[0] | gm

    Deserialized.System.IO.DirectoryInfo

    with the later not having any methods..
    this is similar to export-clixml / import-clixml

    i.e in this example

    $a = dir
    $a | export-Clixml c:\test.xml
    $b = import-Clixml c:\test.xml

    $a |Get-Member
    $b | gm







    MKielman wrote:
    > Does powershell have the ability to fork? The reason I ask is b/c I
    > would like to write a script that pings systems before performing an
    > action. I noticed that the shell allows you to run ping but wanted to
    > find out how I could incorporate that into my script.
    >
    > Thanks



      My System SpecsSystem Spec

  5. #5


    MKielman Guest

    Re: Powershell fork()?

    No that doesn't answer my question, I already understand If statements.

    Andrew Watt [MVP] wrote:
    > On Thu, 12 Oct 2006 11:37:01 -0700, MKielman
    > <mkielman@newsgroups.nospam> wrote:
    >
    >> Does powershell have the ability to fork? The reason I ask is b/c I
    >> would like to write a script that pings systems before performing an
    >> action. I noticed that the shell allows you to run ping but wanted to
    >> find out how I could incorporate that into my script.
    >>
    >> Thanks

    >
    > Hi,
    >
    > I'm not totally sure that this is what you are asking but ...
    >
    > Type
    >
    > get-help about_if
    >
    > Does that do what you want?
    >
    > Andrew Watt MVP


      My System SpecsSystem Spec

  6. #6


    MKielman Guest

    Re: Powershell fork()?

    Thanks!

    dreeschkind wrote:
    > $result = ping www.microsoft.de
    >
    > --
    > greetings
    > dreeschkind
    >
    > "MKielman" wrote:
    >
    >> Does powershell have the ability to fork? The reason I ask is b/c I
    >> would like to write a script that pings systems before performing an
    >> action. I noticed that the shell allows you to run ping but wanted to
    >> find out how I could incorporate that into my script.
    >>
    >> Thanks
    >>


      My System SpecsSystem Spec

Powershell fork()? problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing PowerShell dependent features on W2K8 with PowerShell CTP Greg Wojan PowerShell 14 16 May 2008
when run powershell script as windows service ,powershell fail powershell fail on winodws 2008 PowerShell 6 15 Jan 2008
Powershell Plus - Free for non commercial Use and Powershell Analyzer1.0 released Karl Prosser[MVP] PowerShell 2 12 Dec 2007
Automatic PowerShell Error Parsing in PowerShell Analyzer and PowerShellPlus Karl Prosser[MVP] PowerShell 0 14 Nov 2007
PowerShell Leaders Join Forces and offer a pre-release version of PowerShell for 50% off the retail value klumsy@xtra.co.nz PowerShell 0 19 Jun 2007