VMware Cloud Community
miguelvelezwhit
Enthusiast
Enthusiast

Script to look for a plug-in on a Windows vCenter

Hey gang, sorry that I haven't been around for a spell - taking care of med business.

Here's my question:

I'm tasked with configuring the ESXi Dump Collector to store the coredump in a specific folder on a centralized server.  However, the Dump Collector doesn't show up as a plug-in on vCenter.  It also isn't being found at its designated install area: C:\ProgramData\VMware\VMware ESXi Dump Collector\.  This is already getting into some wild first steps; like finding the vCenter install media and mounting it again so that the dump collector can be installed.  I have 28 vCenters under my care from one end of the country to the other.  Four (4) of those vCenters are VCSAs; which has a totally different process for configuring where the coredump drops.  I really don't wish to go in and out of 24 Windows-based vCenter Servers and perform all of this. However, things would look better if I could find a way to check all 24 by using a script.

Can someone help me with writing a script to check into all these vCenters and search for "C:\ProgramData\VMware\VMware ESXi Dump Collector\" and a provide a true/false response on an Export-CSV file?  It's been a long day and I know my brain is on its way to the check-out counter in about 5 hours.  Someone's brain must be working way better than mind.  It seems simple, but I can't figure it out at the moment.  Can anyone help?

Thanks in advance,

Miguel

Tags (1)
Reply
0 Kudos
1 Reply
LucD
Leadership
Leadership

Perhaps try something like this.

It assumes you are connected to all the vCenters

$global:DefaultVIServers | %{

    $connected = $folderPresent = $false

    $os = ''

    $hostName = $_.ServiceUri.Host

    if(Test-Connection -ComputerName $hostName -BufferSize 16 -Count 1 -ErrorAction SilentlyContinue -Quiet)

    {

        $connected = $true

        $os = Get-WmiObject -ComputerName $hostName -Class Win32_OperatingSystem -ErrorAction SilentlyContinue

        if($os){

            $folderFound = Test-Path -PathType Container -Path "\\$($hostName)\c$\ProgramData\VMware\VMware ESXi Dump Collector"

        }

    }

    [ordered]@{

        HostName = $hostName

        Connected = $connected

        OS = if($os){$os.Caption}else{'VCSA?'}

        FolderPresent = $folderFound

    }

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos