The vSphere Management Assistant (vMA) can be used to remotely manage and troubleshoot multiple hosts from the command line. The vSphere Management Assistant is a SUSE Linux Enterprise-based virtual appliance deployed within your vSphere infrastructure, it allows centralized management and troubleshooting of multiple ESXi hosts with automatic login, and scripting tools for developers. The vMA appliance includes the vSphere Command-Line Interface (vCLI), vSphere SDK for Perl, and components for logging and authentication.
Installation of VMA is pretty straight forward. You only need to download the VMA OVA file and import in your vSPhere or VMware Workstation Environment.
A couple of steps need to be done after the OVF deployment is done like assigning the hostname and ip address, then you are good to go.
After the appliance is up and running and can be accessed over the network then we can add in the ESXi hosts and confiure them to initiate the remote commands. Below is a simple script that will get all the ESXi host information and will do the job for you:
# Get VMA and ESXi Credentials
$VMACreds = Get-Credential
$EsxUserName = Read-Host 'Please Enter ESXi UserName'
$EsxPassword = Read-Host 'Please Enter ESXi Password'
# Open a SSH Session with VMA so the remote commands can be initiated
$SSHSession = New-SSHSession -ComputerName vma.local -Credential $VMACreds -Verbose -Force
#Import vSphere Power CLI Module to grab list of ESXi Hosts
#Get all the ESXi Hosts and assign the objects to the variable
$VMHOSTS = Get-VMHost
foreach ($VMHOST in $VMHOSTS)
$thumbprint = $null
$a = $null
#invoke SSH Command to add the ESXi Hosts in VMA
Invoke-SSHCommand -Command "vifp addserver $VMHOST --username $EsxUserName --password $EsxPassword" -SessionId $SSHSession.SessionId | Out-Null
#VMA Version 5.5 and later requires manually enetering the ESXI SSH Thumbprint, below code will grab the SSH and thumb print and will do the job automatically.
$a = Invoke-SSHCommand -Command "esxcli -s $VMHOST --credstore=CREDSTORE" -SessionId $SSHSession.SessionId | Out-Null
$output = $a.Output
$thumbprint = (($output -split 'thumbprint: ').get(1) -split ' ').get(0)
Write-Host "SSH Thumbprint for $VMHOST is: $thumbprint"
Write-Host "Adding Thumbprint using credstore_admin.pl script"
Invoke-SSHCommand -Command "/usr/lib/vmware-vcli/apps/general/credstore_admin.pl add -s $VMHOST -t $thumbprint" -SessionId $SSHSession.SessionId | Out-Null
#Below line will hardcode the ESXi credentials so you will not have to put in credentials all the time while running remote commands
Invoke-SSHCommand -Command "/usr/lib/vmware-vcli/apps/general/credstore_admin.pl add -s $VMHOST -u $EsxUserName -p $EsxPassword" -SessionId $SSHSession.SessionId | Out-Null