Hi
For some reason the follwowing script bypasses the first host listed in the text file.
#Begin CODE:--------------
Param (
[String]$VC,
[string]$Cluster
)
If ((Get-PSSnapin -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue) -eq $null )
{Add-PSsnapin VMware.VimAutomation.Core -ErrorAction SilentlyContinue}
$Folder = $Cluster
$FilePath = "C:\VMWare-logs\" + $Folder
$ESXHost = Get-Content "C:\Temp\VMHosts.txt"
If ((New-Item -Path $FilePath -ItemType directory -ErrorAction SilentlyContinue) -eq $null)
{New-Item -Path $FilePath -ItemType directory -ErrorAction SilentlyContinue}
Connect-VIServer $VC -WarningAction SilentlyContinue
Foreach ($ESX in $ESXHost) {
Get-Log -VMHost (Get-VMHost -Name $ESX) -Bundle -DestinationPath $FilePath
}
Disconnect-VIserver $VC -confirm:$false
#END CODE -----------------
Thanks
I don't see a problem with your script, maybe check if the script fails to collect log from the first ESXi server?
Or perhaps, double check the input file?
Hi ssbkang,
The result was the same when I treid the script on another cluster in my environment. Also when I ran the script again against the host that was misseed this time the logs were downloaded. Maybe someone could test this script in their lab environmnet to see if they get the same result? Thanks for your response.