Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 229915

Re: PowerCLI - get Image Profile information of ESXi host

$
0
0

Try this:

 

(get-view ((get-vmhost myvmhost.mycompany.com).ExtensionData.ConfigManager.ImageConfigManager)).HostImageConfigGetProfile()

 

Name   : (Updated) Vmware-ESXi-6.0.0-3620759-Custom-Cisco-6.0.2.1

Vendor : Cisco

 

So, if you wanted to get this for all hosts, you can try something along these lines, report style:

 

$outObj=foreach($vmhostin(get-vmhost))

{

   $ImageConfigMgr=(get-view($vmhost.ExtensionData.ConfigManager.ImageConfigManager)).HostImageConfigGetProfile()

 

   New-Object PSObject -Property @{

      esxiHost       =$vmhost.Name

      vCenterCluster =($vmhost|get-cluster).Name

      ImageName      =$ImageConfigMgr.Name

      ImageVendor =$ImageConfigMgr.Vendor

   }

}

 

Now this is probably the fastest way without getting into native code, but no matter what you will need to do at least one get-view call.  I can pull 30 hosts in around a minute, so not bad.  You could have this run as a scheduled task then either save the output object as a cliXML, shove it into a database, or just generate a report.

 

Hope this helps give you a start.


Viewing all articles
Browse latest Browse all 229915

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>