I have a simple PowerShell expression that returns some object properties. It also returns an object called Computer which has a property called ComputerName
which I'm trying to access. The ExpandProperty
switch returns all the properties. How do I filter it to return the properties I need?
Here's the expression:
foreach ($computer in $jobinstancestatus.Computers) {
Select-Object -InputObject $computer -property Status,ResultsPath -ExpandProperty Computer
}
I tried this but it gave an error when I tried to run it.
foreach ($computer in $jobinstancestatus.Computers) {
Select-Object -InputObject $computer -property Status,ResultsPath (-ExpandProperty Computer).ComputerName
}