VMware Cloud Community
piercj2
Enthusiast
Enthusiast

Collecting ESXi Host details using PowerCLI

Hi,

I'm new to PowerCLI, am currently learning PowerShell but, have an immediate requirement that i'm hoping someone can help me with.

I work for a company with a large ESXi deployment, over 2000 hosts, multiple vCenters, etc...

The topology/layout within each vCenter is quiet similar.

  • everything is version 5.5
  • There can be one or more DataCenters
  • under each DataCenter will be a number of folders
  • within each folder will be a number of ESXi Hosts and their corresponding VMs

For Example

  •      vCenter "MyVcenter"
    • DataCenter1 "Europe"
      • Folder1 "France"
        • ESXi Host "France1"
        • ESXi Host "France2"
      • Folder2 "Germany"
      • Folder3 "xyz"
    • DataCenter2 "Americas"
      • Folder1 "Washington"
      • Folder2 "Massachusetts"
        • ESXi Host "Ma1"
        • ESXi Host "Ma2"
      • etc...

We have a continuous Patching Policy to ensure that the ESXi Hosts have the latest VMware Patches/Updates installed.

I need a script that will allow me to nominate a particular DataCenter and then for each host within the DataCenter will provide the following

  1. Host name
  2. Management IP
  3. Build Number
  4. Summary of Patches installed
  5. Confirmation if a Reboot is required or not (after patches have been installed)
  6. Current State (connected, not connected, in Maintenance Mode, powered off, etc...)

As you can imagine, going through all the DataCenters and Hosts to get the above information is extremely time consuming.

I've been searching through the Communities, Forums, bloggers websites, etc...

I've found various scripts that individually will give me pieces of the puzzle but nothing that will give the above in one nicely packaged script.

I've tried combining the various scripts that I've come across but, they are using both cmdlets and Get-View, I'm getting tripped up trying to combine the lot.

I understand that from a performance perspective, Get-View is better but, I'm still coming to grips with Managed Objects, and am a long way from being able to create the above on my own.

Any help that can be offered would be appreciated, even if it's just naming a few good books/training courses on PowerCLI.

Thanks

0 Kudos
0 Replies