VMware VM Inventory report with multiple details.

This script will connect to vSphere client and get the VMs from connected VC. It will gather all the VM information which needs for every Admin to have as a VM inventory to check quickly or refer in future if something goes wrong.

 
 
 
 
 
5 Star
(1)
2,234 times
Add to favorites
Servers
1/29/2017
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • VM Inventory == Awesome script !
    3 Posts | Last post May 07, 2019
    • Amol, thank you Sir for the script. 
      I am not a scripting geek but I did find this script very useful with the amount of details that are exported.
      I do get an error so any insight on this would be helpful
      
      `````````````````````````````````````````````````````
      Get-View : Cannot validate argument on parameter 'VIObject'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
      At line:226 char:30
      +         $hostIP = $vm.Host | Get-View | select @{N=“IPAddress“;E={($_ ...
      `````````````````````````````````````````````````````
    • I had to make one change to fix the error.
      
      Before:
      $hostIP = $vm.Host | Get-View | select @{N=“IPAddress“;E={($_.Config.Network.Vnic | ? {$_.Device -eq "vmk0"}).Spec.Ip.IpAddress}}
      
      Fix:
      $hostIP = $vm.VMHost | Get-View | select @{N=“IPAddress“;E={($_.Config.Network.Vnic | ? {$_.Device -eq "vmk0"}).Spec.Ip.IpAddress}}
      
      
      $vm.Host had to be changed to $vm.VMHost
    • Hey Srini, 
      
      Thank you for the feedback and sorry for the delay in reply. 
      Yes, with new ESXi version Host, Datastore etc. command is little bit modified but never had a chance to update it here. 
      
      Thanks for fixing it :) I will do the same     
  • PowerCLI
    4 Posts | Last post September 25, 2018
    • Your script looks promising and thanks you for your effort, but It keeps asking to install PowerCLI while its already installed. Tried different version and still doing the same .
      
      Thanks
      
      
      
    • Might be required version not matching.
    • Thanks for the script. I was also facing the same problem. it was keep saying to install the PowerCLI. than I reinstall the old version of PowerCLI and it workks. but I think your script need to be update as we are using VMware 6.5 and some of power shall command is not working. I was getting the below warning When I was trying to pull the VMware 6.5 VM details.
      -----------------------------
      WARNING: The 'Host' property of VirtualMachine type is deprecated. Use the
      'VMHost' property instead.
      WARNING: The 'HardDisks' property of VirtualMachine type is deprecated. Use
      'Get-HardDisk' cmdlet instead.
      WARNING: The 'State' property of VMHost type is deprecated. Use the
      'ConnectionState' property instead.
    • Yeah, true now with version 6.5 Host is replaced with VMHost. 
      Need to update once get free time :)
      Thanks for the feedback.