BladeSystem - General
1752667 Members
5544 Online
108788 Solutions
New Discussion

Powershell Script to get Array Diagnostic Utility (ADU) Report online in vSphere ESXi.

 
chuckk281
Trusted Contributor

Powershell Script to get Array Diagnostic Utility (ADU) Report online in vSphere ESXi.

Marcio created a new PowerShell script for integrating ADU into VMware ESXi software:

 

************

 

Hello Guys,

 

I create one script to run HP ADU logs in many hosts vSphere at same time.

 

In my tests the command “hpssaduesxi” running fine in 5.5 with version “1.60.17.0” and 5.0 with “2.0.23.0”.

 

 

----------------------------------------

 

Follow the script:

 

# Reading a list of hosts

 

# Sample file format for CSV

 

# File Content

#-----------------------------------

#hostname,username,password

#hostnameA.domain,root,password_for_root

#hostnameB.domain,root,password_for_root

#-----------------------------------

 

# File Content

#-----------------------------------

#hostname,username,password

#server1.hp.com,root,P@ssword!

#-----------------------------------

 

Import-Csv "C:\Scripts\servidores.csv" | ForEach-Object {

$hostname = $_."hostname"

$username = $_."username"

$password = $_."password"

$filename = $hostname.split(".")

$filename = $filename[0] + ".zip"

 

# Connect to vSphere ESXi Host

 

Connect-VIServer $hostname -user $username -password $password

 

# Get vSphere ESXi version

 

$versao = get-view -ViewType HostSystem -Property Name,Config.Product | foreach {$_.Name, $_.Config.Product} | select Version

 

# echo $versao

 

if ($versao -match "5.5.0")

 

{

       echo "ESXi Versão 5.5....."

 

       # Mount HDU Command Line based of vSphere Version

 

       $comando = "C:\scripts\hpssaducli55\bin\hpssaduesxi --server=$hostname --user=$username --password=$password C:\scripts\Reports\$filename"

 

       # Executing External Command

 

       cmd /c $comando

}

 

if ($versao -match "5.0.0")

 

{

       echo "ESXi Versão 5.0....."

 

       # Mount HDU Command Line based of vSphere Version

 

       $comando = "C:\scripts\hpssaducli50\bin\hpssaduesxi --server=$hostname --user=$username --password=$password C:\scripts\Reports\$filename"

 

       # Executing External Command

 

       cmd /c $comando

}

 

# Disconnect vSphere Host

 

Disconnect-VIServer $hostname -confirm:$false

 

echo "----------------------------------------------------------"

 

}

 

-------------------------------------------------- Regards

 

***********

 

Any feedback or comments?