search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Get vHBA WWN information of Virtual Machines
Posted in Virtual Machine Manager, Windows Powershell | No Comment | 1,862 views | 28/01/2014 15:56

You can use following script to get vHBA WWN information of virtual machines.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$Clusters = Get-Content Clusters.txt
$Counter = 0;
foreach ($Cluster in $Clusters)
{
	$ClusterNodes = Get-Cluster $Cluster | Get-ClusterNode
	foreach ($ClusterNode in $ClusterNodes)
	{
		$VMs = Get-VM -ComputerName $ClusterNode
		foreach ($VM in $VMs)
		{
			$vHBAs = $VM.FibreChannelHostBusAdapters
			if ($vHBAs)
			{
				Write-Host " "
				Write-Host " "
				Write-Host $VM.Name
				$Counter++
				Write-Host " "
				foreach ($vHBA in $vHBAs)
				{
					Write-Host SanName: $vHBA.SanName
					Write-Host SetA: $vHBA.WorldWidePortNameSetA
					Write-Host SetB: $vHBA.WorldWidePortNameSetB
					Write-Host " "
				}
			}
		}
	}
}
 
Write-Host Total VM: $Counter

You should add your cluster nodes into clusters.txt file.



Leave a Reply