Support Bundles can be easily generated by accessing vSphere Client -> File -> Export -> Export System Logs although the process is manual and potentially time consuming.
As almost everything in VMware environment even the support bundle collection process can be easily automated using PowerCLI.
The Get-Log PowerCLI cmdlet is used to retrieve support bundle either from vCenter Server either from ESXi hosts.
When connected to a vCenter Server running:
Get-Log -Bundle -DestinationPath C:\Users\Paolo\Desktop
will download in specified location support bundle for vCenter Server.
Support bundle will be named: vcsupport-<Generated_ID>.zip
To download support bundles for specific ESXi host(s) only:
Get-Log -VMHost (Get-VMHost -Name 192.168.243.144) -Bundle -DestinationPath C:\Users\Paolo\Desktop
where 192.168.243.144 is the IP address of ESXi host to download support bundle from.
This time file will be named: vmsupport-<Generated_ID>.tgz
To automate bundles retrieval for any ESXi host managed by a specific vCenter Server, including support bundle for vCenter itself, you can use the following script:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Variable declaration | |
$vCenterIPorFQDN="192.168.243.172" | |
$vCenterUsername="Administrator@vsphere.local" | |
$vCenterPassword="vmware" | |
$destination = "C:\Users\Paolo\Desktop" #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 | |
} |
As usual you can also find the script above in my GitHub page: DownloadSupportBundles.ps1
Support bundle download is also achieved by simply connecting, using a web browser, to an ESXi host to the following address:
https://<username>:<password>@<ESXi_host_IP_address>/cgi-bin/vm-support.cgi
The previous step can be automated using PowerShell (not PowerCLI). This could be useful when in need to get support bundles rapidly using a PC/server where PowerCLI is not installed (only PowerShell is needed).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Variable declaration | |
$hosts=@("192.168.243.144","10.0.1.62") #ESXi hosts to download support bundles from | |
$username="root" #ESXi host username | |
$password="vmware" #ESXi host password | |
$destination = "C:\Users\Paolo\Desktop" #Location where to download support bundles | |
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} #Ignore SSL certificate validation | |
foreach ($element in $hosts){ | |
$wc = New-Object System.Net.WebClient | |
$wc.Credentials = new-object System.Net.NetworkCredential($username, $password) #This assumes all hosts having same username and password | |
$wc.DownloadFile("https://"+$element+"/cgi-bin/vm-support.cgi", $destination + "\" + $element + ".tgz") #Download support bundle | |
} |
That's all!!