search
Categories
Archive
Blogroll

Badges

Microsoft PowerShell MVP
MCSE
Sponsors

VirtualMetric
Cozumpark Bilisim Portali
Getting Hyper-V VMs list which has virtual HBA via PowerShell
Posted in Windows Powershell, Windows Server | No Comment | 542 views | 19/06/2013 10:29

You can use this script to get virtual machines which has Virtual HBA support.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$Servers = Get-Content C:\hosts.txt
foreach ($Server in $Servers)
{
	$VMs = Get-VM -ComputerName $Server
	Write-Host $Server
	foreach ($VM in $VMs)
	{
		$TestFC = $VM | Select -expand FibreChannelHostBusAdapters
		if ($TestFC)
		{
			$Value = $VM.Name + "," + $VM.ComputerName
			Add-Content -Value $Value -Path C:\Servers.txt
		}
	}
}

I’ve added all my Hyper-V hostnames into C:\hosts.txt to use this script.



Leave a Reply