This Blog is to share our knowledge and expertise on Linux System Administration and VMware Administration

Wednesday, September 13, 2017

Collecting diagnostic information of all ESXi By using PowerCLi Script

VMware Technical Support routinely requests diagnostic information from you when a support request is handled. This diagnostic information contains product specific logs, configuration files, and data appropriate to the situation. The information is gathered using a specific script or tool for each product and can include a host support bundle from the ESXi host and vCenter Server support bundle. Data collected in a host support bundle may be considered sensitive.



This article provides the procedures for obtaining this diagnostic information of all ESX/ESXi hosts using VMware vSphere PowerCLI.

 #Variable declaration
$vCenterIPorFQDN="VCName"
$vCenterUsername="domain\user" #Any User name who has access to Vcenter.
$vCenterPassword="xxxx"
$destination ="C:\Users\user\Desktop\naga\" #Location where to download support bundles
 
Write-Host "Connecting to vCenter" -foregroundcolor "magenta"
Connect-VIServer -Server $vCenterIPorFQDN -User $vCenterUsername -Password $vCenterPassword
 
$hosts = Get-VMHost #Retrieve all hosts from vCenter
 
Write-Host "Downloading vCenter support bundle" -foregroundcolor "magenta"
Get-Log -Bundle -DestinationPath $destination
 
foreach ($esxihost in $hosts){
Write-Host "Downloading support bundle for ESXi host $($esxihost.Name)" -foregroundcolor "magenta"
Get-Log -VMHost (Get-VMHost -Name $esxihost.Name) -Bundle -DestinationPath $destination
}


No comments:

Post a Comment