Üsing this script we can download esx log files to local computer, which is running powercli.

save this script as ps1

 

#############################################################
# We can use this script to downlog log files from esx hosts#
# #
# #
# #
#############################################################
Write-Host “Please create a esxlogs folder in your C drive before you run this script. This will download vmkernel,hostd & vpxa log files to your computer”
Add-PSSnapin vmware.vimautomation.core
Add-PSSnapin vmware.deployautomation
$vcentername=Read-Host “Enter Vcenter Name”
$esxhostname=Read-Host “Enter ESX host Name”
Connect-viserver $vcentername
$esxvmkernel=(get-log -key vmkernel -vmhost $esxhostname).entries
$esxvmhostd=(get-log -key hostd -vmhost $esxhostname).entries
$esxvpxa=(get-log -key vpxa -vmhost $esxhostname).entries

Add-Content -path c:\esxlogs\$esxhostname””vmkernel.txt -value $esxvmkernel

Add-Content -path c:\esxlogs\$esxhostname””hostd.txt -value $esxvmhostd

Add-Content -path c:\esxlogs\$esxhostname””vpxa.txt -value $esxvpxa

Advertisements