Posts mit dem Label Get-Process werden angezeigt. Alle Posts anzeigen
Posts mit dem Label Get-Process werden angezeigt. Alle Posts anzeigen

Sonntag, 27. Dezember 2009

Small Get-Process Puzzle

Hello PowerShell folks,

here I have a small puzzle for you. Please start only one instance of PowerShell odr PowerShell_ISE and run the following script.

$p1 = get-process powershell*             
$p2 = get-process powershell*

$p1
$p2

$p1 -eq $p2

Compare-Object $p1 $p2 -IncludeEqual


This time I'm not confuesed, that Compare-Object tells that both processes are equal. This time I wonder why $p1 is not equal To $p2.

When you invoke $p1 a number of times, you will see that the value CPU(s) increases. My natural expectation here is same PID same process.

Is this a PowerShell or a .NET issue ?
Do I better keep using WMI?

I get the rather strange feeling 'The more I learn, the less I know'.

Bernd