01 / MODEL A WINDOWS FLEET · LESSON 03

Identify processes across computers

Report memory-heavy processes while keeping computer, process ID, and start time together.

12 min · learn at your pace

A name is not an identity

Each fixture computer runs two processes called lab-worker. Different computers also reuse process ID 410. A process name alone cannot identify the instance you intend to investigate, and even a PID can be reused after a process exits.

Keep ComputerName, Id, and StartTime together when you build a review queue. StartTime lets a later action detect that a PID now belongs to a different instance. A production workflow still has a race between checking and acting; this simulation makes the identity rule visible without pretending to remove that race.

Read the numbers correctly

WorkingSet64 is a byte count. Divide by 1MB to report WorkingSetMiB. CPU is cumulative processor time in seconds, potentially summed across processors. A high value can simply mean the process has run for a long time. It is not current CPU utilisation.

This task selects non-protected processes using at least 128 MiB on app01 and db01. Excluding protected processes is part of the reporting policy, not a claim that a flag can make a real process safe to stop.

Objects before presentation

Return one object per selected process. Keep numeric memory and CPU values so the next command can sort or compare them. Format-Table belongs at the display boundary. The following lesson uses two observations to calculate a CPU rate and rejects comparisons where process identity has changed.

Go deeper

Read the official reference.

Try an example.ps1
Import-Module '/home/user/LabFleet.psm1' -Force
Get-LabProcess app01 | Select-Object Id,ProcessName,CPU,WorkingSet64,StartTime
YOUR TURN

Put it into practice.

For app01 and db01, emit non-protected processes with WorkingSet64 >= 128MB. Return ComputerName, Id, ProcessName, StartTime, numeric WorkingSetMiB, and CpuSeconds. Preserve both matching instances, even though their PIDs and names are equal.

See an explained solution
One way to solve it.ps1
Import-Module '/home/user/LabFleet.psm1' -Force
foreach($name in 'app01','db01') {
    Get-LabProcess $name | Where-Object { -not $_.Protected -and $_.WorkingSet64 -ge 128MB } | ForEach-Object {
        [pscustomobject]@{ ComputerName=$_.ComputerName; Id=$_.Id; ProcessName=$_.ProcessName; StartTime=$_.StartTime; WorkingSetMiB=$_.WorkingSet64/1MB; CpuSeconds=$_.CPU }
    }
}

The report preserves computer and process instance identity while expressing memory in MiB. Cumulative processor seconds remain a separate observation.