VMware Cloud Community
Rick360
Contributor
Contributor
Jump to solution

Where clause question

Hello,

I'm reviewing a script I found that returns guest information and whether hot add is enabled:

Get-VM | Get-View | Select Name, `

@{N="CpuHotAddEnabled";E={$_.Config.CpuHotAddEnabled}}, `

@{N="CpuHotRemoveEnabled";E={$_.Config.CpuHotRemoveEnabled}}, `

@{N="MemoryHotAddEnabled";E={$_.Config.MemoryHotAddEnabled}}

How would I limit this to show where CpuHotAddEnabled = false ?

When I pipe the above to a where I receive "The property 'CpuHotAddEnabled' cannot be found on this object"

Thanks.

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try like this

Get-VM | Get-View |

where{$_.Config.CpuHotAddEnabled -ne $true} |

Select Name,

@{N="CpuHotAddEnabled";E={$_.Config.CpuHotAddEnabled}},

@{N="CpuHotRemoveEnabled";E={$_.Config.CpuHotRemoveEnabled}},

@{N="MemoryHotAddEnabled";E={$_.Config.MemoryHotAddEnabled}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

Try like this

Get-VM | Get-View |

where{$_.Config.CpuHotAddEnabled -ne $true} |

Select Name,

@{N="CpuHotAddEnabled";E={$_.Config.CpuHotAddEnabled}},

@{N="CpuHotRemoveEnabled";E={$_.Config.CpuHotRemoveEnabled}},

@{N="MemoryHotAddEnabled";E={$_.Config.MemoryHotAddEnabled}}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
Rick360
Contributor
Contributor
Jump to solution

Thank You LucD, I was thinking in SQL I guess!!!

Reply
0 Kudos