VMware Cloud Community
petuser
Contributor
Contributor
Jump to solution

Problems with get-compliance and select-object

Hi everybody

I want to generate a compliance report for our hosts and execute a command similar to "Get-Compliance -Entity <hostname> | Select-Object Entity, Baseline". I expect to have the same output as for "Get-Compliance -Entity <hostname>" exept for the missing "Status" column. Instead I get allways the same entry (VMware.VumAutomation.Types.PatchBaselineImpl) in all the "Baseline" column.

Any idea what I am doing wrong.

Thank's in advance for any help

Pedro

Reply
0 Kudos
1 Solution

Accepted Solutions
RvdNieuwendijk
Leadership
Leadership
Jump to solution

Hi Pedro,

try it like this:

Get-Compliance -Entity <hostname> | Select-Object Entity,@{N="Baseline";E={$_.Baseline.Name}}


The problem is that the Baseline property is an object not a string. If you pipe it to Select-Object it tries to make a string out of it. And the string it generates is the type of the object.

Regards, Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition

View solution in original post

Reply
0 Kudos
2 Replies
RvdNieuwendijk
Leadership
Leadership
Jump to solution

Hi Pedro,

try it like this:

Get-Compliance -Entity <hostname> | Select-Object Entity,@{N="Baseline";E={$_.Baseline.Name}}


The problem is that the Baseline property is an object not a string. If you pipe it to Select-Object it tries to make a string out of it. And the string it generates is the type of the object.

Regards, Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Reply
0 Kudos
petuser
Contributor
Contributor
Jump to solution

Hi Robert

Thank's for the answer. This works as expected.

Cheers,

Pedro

Reply
0 Kudos