Needs to execute some powerCLI comments in the vCenter by sorting out the ESXI model (Gen9)

Needs to execute some powerCLI comments in the vCenter by sorting out the ESXI model (Gen9)

Hi Experts,

I wanted to run some powerCLI comments in vCenter that comment needs to fetch all the available esxi in vCenter and apply only when  ESXi server is Gen9. Could someone give me the logic to sort out the Gen9 esxi servers and execute my comments


ESXI gen9.png

Thanks in advance



Comments

Try with

Get-VMhost |
Where{$_.ExtensionData.Hardware.SystemInfo.Model -match 'Gen9'} |
Foreach-Object -Process {
# Your commands
}

You post would be better located here: https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/bd-p/2805

Nobody can move this post as it is not of the "discussion" type.

 

@scott28tt 

Hi Scott,

I am extremely sorry.

Next time I will post in the link which you have mentioned above.

Mr @LucD  Provided me the right answer. 

How can I make his answer as right answer ?

I am not getting that option to make his answer as right answer. 

 @LucD 

Hi Expert,

Thanks much for your logic and code.  Its perfect. 

Its working like a charm. 

I am sorry as scott mentioned above I have posted my question in a wrong place.  So I am not getting option to make your answer as right answer (I have attached the screenshot below)

If you know how to make your answer as right answer then could you please let me know ?

I wanted to give the credits to you.

Thanks again. ::)

Not getting option to make your answer as right answer.Not getting option to make your answer as right answer.

 

No answers can be marked as the solution because this is not a "discussion" post, this is a "document" post which is intended for someone to post a reference document for others to use and comment on.

 

@scott28tt 

Thanks for the reply scott. Got it.

Is it possible any way to move my question there ?

I'm afraid not.
You can create a new thread in the PowerCLI discussion forum, and then I will copy my reply there.

@LucD 

Yeah Sure. 

I will create a new thread. You can copy-paste your reply there. 

Posts cannot be moved between "document" areas and "discussion" areas - that is a limitation of the forum software.

I see you have found the PowerCLI Discussions area now.

 

They can be moved, but the moderators do not have the required permissions on this "documents" forum.

In any case, in a couple of days we will all be on a new platform.
I guess we will encounter more important issues than just this annoyance 😅

@scott28tt 

Got it, Scott. Next time I won't make this mistake. 

@LucD 

Lol 😁

Version history
Revision #:
1 of 1
Last update:
‎03-26-2024 02:08 AM
Updated by: