When I run this:
Get-Process -name csrss -ComputerName (
Get-AdComputer -Filter {
(name -eq "gate") -or (name -eq "client")
} | Select-Object -ExpandProperty name
) | Select-Object Name,MachineName
or
Get-Process -name csrss -ComputerName gate,client | Select-Object Name,MachineName
I get selected processes from the two computers:
Name MachineName ---- ----------- csrss CLIENT csrss GATE csrss CLIENT csrss GATE
But when I run this:
Get-AdComputer -Filter {(name -eq "gate") -or (name -eq "client")} |
Select-Object @{Name='computername';Expression={$_.name}} |
Get-Process -name csrss |
Select-Object name,machinename
I get this output:
Name MachineName ---- ----------- csrss GATE csrss GATE
If i change name client
to DC
(it's a localhost) it shows processes only from DC. And it doesn't matter in which order I type the computer names (GATE first or DC first).
Even if I type this:
Get-AdComputer -Filter * |
Select-Object @{Name='computername';Expression={$_.name}} |
Get-Process -name csrss |
Select-Object name,machinename
I get output only from one machine (DC=localhost):
Name MachineName ---- ----------- csrss DC csrss DC
Why does this happen? Why do I get processes only from one machine?
I can't get the logic, how Get-Process
is getting ComputerName
in the third case.
-computername $_.computername
to the gps command? – Martin Brandl-computername $_.computername
I get an error. If i add-computername {$_.computername}
the result is the same. – 3y6pe