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