Quantcast
Channel: VMware Communities : Blog List - All Communities
Viewing all articles
Browse latest Browse all 3135

PowerShell script to gather ESXi host details

$
0
0

I came across a situation where I had to quickly gather details of all ESXi host hardware details. For small environment this can be obtained via VIClient UI but if the environment is large it makes lot of sense to have some script ready to serve this purpose for you. After some hit-n-trials finally the script was ready to capture these details and the entire process of collecting around 300 host details was so fast that the output was ready and stored in a nice .csv format within minute.

So here is the script and required pre-requisites to run it

  1. Server from where this script is run should have Powershell & PowerCLI (modules) installed on it
  2. However the script should call for VMware snapins to run itself but incase it fails to do so please add “VMware.VimAutomation.Core” snapin manually into Powershell
  3. The server from where you are running this script shall talk to vCenter server on Port 443
  4. Replace the BOLD values with desired vCenter server details & credentials

 

Connect-VIServer -Server server_fqdn -User username -Password passwd

Add-PSSnapin VMware.VimAutomation.Core -ErrorAction 'SilentlyContinue'

Clear-Host

$esxi = Get-VMHost | Sort Name

$D = $esxi | Select-object @{N="HostName";E={ $_ | Get-VMHostNetwork | select -ExpandProperty Hostname}},Manufacturer,Model,ProcessorType,NumCpu,MemoryTotalGB,Version,Build

$D | Export-Csv -Path "path_name\file_name.csv"


With this I end this blog.... I hope it helps... .till then Happy Reading..


Viewing all articles
Browse latest Browse all 3135

Trending Articles



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