VMware Cloud Community
satheeshsatz
Enthusiast
Enthusiast
Jump to solution

Powercli Script to collect Standalone ESXi hosts from vcenter server.

we have around 4vcenter servers and it have many standalone servers.

i am able to get all the hosts lists and get finding its cluster, if its null i am updating it as "standalone", but this is not helping in speed and duplication of multiple actions.

Hence i am looking for powercli Script to collect Standalone ESXi hosts from vcenter server.

Regards, Satheesh
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You should be able to get all standalone ESXi nodes with

Get-VMHost | where{$_.Parent.Name -eq 'host'}


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

View solution in original post

0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

You should be able to get all standalone ESXi nodes with

Get-VMHost | where{$_.Parent.Name -eq 'host'}


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

0 Kudos
satheeshsatz
Enthusiast
Enthusiast
Jump to solution

i am seeing only less number of servers and i can see that many esxihosts are placed under folders.

hence i have added "HostAndCluster" as well.

Get-VMHost | where{$_.Parent.Type -eq 'HostAndCluster'}

is that fine?

Regards, Satheesh
0 Kudos
LucD
Leadership
Leadership
Jump to solution

If you created Folders into which you moved your ESXi nodes, then yes, you would have to include the names of the folders as well.

But in that case, it is probably easier to just check the type of the Parent.

Get-VMHost | where{$_.Parent.GetType().Name -eq 'FolderImpl'}


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

0 Kudos