Pages

Showing posts with label WWN Number using Powershell. Show all posts
Showing posts with label WWN Number using Powershell. Show all posts

Wednesday, February 4, 2015

HBA Information from Remote Windows Machines

Create a text file named servers.txt and put all servers in the file (one server at one line)

Copy and paste the below code (in Blue) in a text file and  save it as HBAInfo.Ps1 and put both servers.txt and HBAInfo.ps1 at the same location.

Execute the script from powershell console as .\HBAInfo.ps1


Get-Content .\Servers.txt | ForEach-object {

$SrvName = $_

# Loop only executed when ping is successful
if (test-connection -computername $SRVName -count 1 -quiet)
{
Get-WmiObject -computername $SRVName -class MSFC_FCAdapterHBAAttributes -namespace "root\WMI" |select __SERVER,@{Name='Node WWN';Expression={(($_.NodeWWN | % {"{0:x2}" -f $_}) -join ":").ToUpper()}},Active,DriverName,HBAStatus,MAnufacturer,NumberofPorts
}Else { Write-Warning "$SRVName cannot be reached, skipping."

}} |export-Csv -NoTypeInformation hbaDetails.csv



Wait for the script to finish and a csv file will be ready with all the information at the same location where script is located.