Share via


Test Hyper-V over SMB configuration with Windows Server 2012 - Step-by-step Installation using PowerShell

1. Overview

In this post, I am sharing all the steps I used to create a Windows Server 2012 File Server test environment that I used for some of my Hyper-V over SMB demonstrations. My goal with this post is to share some of configuration details and the exact PowerShell scripts I used to configure the environment (if you look carefully, you might be able to spot a few PowerShell tricks and tips). For me, this is a convenient reference post that I will likely use myself to cut/paste from when configuring my demo systems in the future.

This uses 5 physical machines, since the scenario involves deploying Hyper-V hosts and you can’t virtualize Hyper-V itself (I have another post that cover SQL Server over SMB in a fully virtualized environment). I am also using RDMA interfaces on the setup with SMB Direct, and those also can’t be virtualized. The demo setup includes one domain controller (which also doubles as an iSCSI target), two file servers and two Hyper-V hosts.

This is probably the most basic fault-tolerant Hyper-V over SMB setup you can create that covers the entire spectrum of new SMB 3.0 capabilities (including SMB Transparent Failover, SMB Scale-Out, SMB Direct and SMB Multichannel). If you build a similar configuration, please share your experience in the comments below the post.

Please keep in mind that this is not a production-ready configuration. I built it entirely using 5-year-old desktop class machines. To improved disk performance, I did add 3 SSDs to one of the machines to used as storage for my cluster, which I configured using Storage Spaces and the Microsoft iSCSI Software target included in Windows Server 2012. However, since I only had three small SSDs, I used a simple space, which cannot tolerate disk failures. In production, you should use mirrored spaces. Also keep in mind that the FST2-DC1 machine itself is a single point of failure, so you’re really only tolerant to the failure of one the two Hyper-V hosts or one of the File Server nodes. In summary, this is a test-only configuration.

 

2. Environment details

The environment is deployed as 5 physical machines, all using the FST2.TEST domain. Here’s a diagram of the setup so you can better understand it:

image

 

Here are the details about the names, roles and IP addresses for each of the computers involved, including the cluster objects and VMs:

Computer Role External Internal RDMA 1 RDMA 2
fst2-dc1 DNS, Domain Controller, iSCSI Target DHCP 192.168.100.10/24 192.168.101.10/24 N/A
fst2-fs1 File Server 1 DHCP 192.168.100.11/24 192.168.101.11/24 192.168.102.11/24
fst2-fs2 File Server 2 DHCP 192.168.100.12/24 192.168.101.12/24 192.168.102.12/24
fst2-hv1 Hyper-V Server 1 DHCP 192.168.100.13/24 192.168.101.13/24 192.168.102.13/24
fst2-hv2 Hyper-V Server 2 DHCP 192.168.100.14/24 N/A 192.168.102.14/24
fst2-fsc File Server Cluster Name Object DHCP N/A N/A N/A
fst2-fs Classic File Server Cluster N/A 192.168.100.22/24 192.168.101.22/24 192.168.102.22/24
fst2-so Scale-Out​ File Server Cluster N/A N/A N/A N/A
fst2-hvc Hyper-V Cluster Name Object DHCP N/A N/A N/A
fst2-vm* Virtual Machine DHCP N/A N/A N/A

 

Last but not least, here’s a picture of the setup, so you can get a sense of what it looks like:

image

 

3. Steps to configure FST2-DC1 (DNS, Domain Controller, iSCSI Target)

# Note 1: This post assumes you already installed Windows Server 2012 and configured the computer name. For details on how to do this, see this previous blog post.
# Note 2: This setup uses InfiniBand RDMA interfaces. For specific instructions on that part of the configuration (driver download, OpenSM subnet manager), see this previous blog post.
#

#
# Set power profile
#
POWERCFG.EXE /S SCHEME_MIN

#
# Configure all 4 interfaces (1 DHCP, 3 static)

#
# Rename External, no further action required, since this is DHCP
#
Get-NetAdapter -InterfaceDescription "*Intel*"   | Rename-NetAdapter -NewName "External"

#
# Rename Internal, set to manual IP address, configure IP Address, DNS
#
Get-NetAdapter -InterfaceDescription "*Realtek*" | Rename-NetAdapter -NewName "Internal"
Set-NetIPInterface -InterfaceAlias Internal -DHCP Disabled
Remove-NetIPAddress -InterfaceAlias Internal -Confirm:$false
New-NetIPAddress -InterfaceAlias Internal -IPAddress 192.168.100.10 -PrefixLength 24
Set-DnsClientServerAddress -InterfaceAlias Internal -ServerAddresses 192.168.100.10

#
# Rename RDMA1, set to manual IP address, configure IP Address, DNS
#
Get-NetAdapter -InterfaceDescription "*IPoIB*" | Select -Last 1 | Rename-NetAdapter -NewName RDMA1
Set-NetIPInterface -InterfaceAlias RDMA1 -DHCP Disabled
Remove-NetIPAddress -InterfaceAlias RDMA1 -Confirm:$false
New-NetIPAddress -InterfaceAlias RDMA1 -IPAddress 192.168.101.10 -PrefixLength 24
Set-DnsClientServerAddress -InterfaceAlias RDMA1 -ServerAddresses 192.168.100.10
Get-NetAdapter -InterfaceDescription "*IPoIB*" | ? {$_.Name -ne "RDMA1"} | Rename-NetAdapter -NewName RDMA2

#
# Disable RDMA2, since this system only uses one RDMA interface
#
Disable-NetAdapter -InterfaceAlias RDMA2 -Confirm:$false

#
# Configure Storage Spaces, create pool with 3 disks, single simple space
#
$s = Get-StorageSubSystem -FriendlyName *Spaces*
New-StoragePool -FriendlyName Pool1 -StorageSubSystemFriendlyName $s.FriendlyName -PhysicalDisks (Get-PhysicalDisk -CanPool $true)
Set-ResiliencySetting -Name Simple -NumberofColumnsDefault 3 -StoragePool (Get-StoragePool -FriendlyName Pool1)

#
# Create Space (virtual disk)
#
New-VirtualDisk -FriendlyName Space1 -StoragePoolFriendlyName Pool1 -ResiliencySettingName Simple -UseMaximumSize

#
# Initialize Space, partition, create volume, format as X:
#
$c = Get-VirtualDisk -FriendlyName Space1 | Get-Disk
Set-Disk -Number $c.Number -IsReadOnly 0
Set-Disk -Number $c.Number -IsOffline 0
Initialize-Disk -Number $c.Number -PartitionStyle GPT
New-Partition -DiskNumber $c.Number -DriveLetter X -UseMaximumSize
Initialize-Volume -DriveLetter X -FileSystem NTFS -Confirm:$false

#
# Install iSCSI Software Target
#
Install-WindowsFeature FS-iSCSITarget-Server

#
# Create iSCSI target for two initiators (configured by IP address) with 5 LUNs (1GB for witness disks, four 100GB for data disks)
#
New-IscsiServerTarget -TargetName FSTarget -InitiatorID IPAddress:192.168.101.11, IPAddress:192.168.101.12
New-IscsiVirtualDisk -DevicePath X:\LUN0.VHD -size 1GB
1..4 | % {New-IscsiVirtualDisk -DevicePath X:\LUN$_.VHD -size 100GB}
Add-iSCSIVirtualDiskTargetMapping -TargetName FSTarget -DevicePath X:\LUN0.VHD
1..4 | % {Add-iSCSIVirtualDiskTargetMapping -TargetName FSTarget -DevicePath X:\LUN$_.VHD}

#
# Install Active Directory
#
Install-WindowsFeature AD-Domain-Services

#
# Create AD forest, reboots at the end
#
Install-ADDSForest `
-CreateDNSDelegation:$false `
-DatabasePath "C:\Windows\NTDS" `
-DomainMode "Win2008R2" `
-DomainName "FST2.TEST" `
-DomainNetBIOSName "FST2" `
-ForestMode "Win2008R2" `
-InstallDNS:$true `
-LogPath "C:\Windows\NTDS" `
-SafeModeAdministratorPassword (Read-Host -AsSecureString -Prompt "Enter Password") `
-SYSVOLPath "C:\Windows\SYSVOL"

 

4. Steps to configure FST2-FS1 (File Server 1)

#
# Set service power profile
#
POWERCFG.EXE /S SCHEME_MIN  
 
#
# Configure all 4 interfaces (1 DHCP, 3 static)
#

#
# Rename External, no further action required, since this is DHCP
#
Get-NetAdapter -InterfaceDescription "*Intel*" | Rename-NetAdapter -NewName "External"

#
# Rename Internal, set to manual IP address, configure IP Address, DNS
#
Get-NetAdapter -InterfaceDescription "*Realtek*" | Rename-NetAdapter -NewName "Internal"
Set-NetIPInterface -InterfaceAlias Internal -DHCP Disabled
Remove-NetIPAddress -InterfaceAlias Internal -Confirm:$false
New-NetIPAddress -InterfaceAlias Internal -IPAddress 192.168.100.11 -PrefixLength 24
Set-DnsClientServerAddress -InterfaceAlias Internal -ServerAddresses 192.168.100.10

#
# Rename RDMA1, set to manual IP address, configure IP Address, DNS
#
Get-NetAdapter -InterfaceDescription "*IPoIB*" | Select -Last 1 | Rename-NetAdapter -NewName RDMA1
Set-NetIPInterface -InterfaceAlias RDMA1 -DHCP Disabled
Remove-NetIPAddress -InterfaceAlias RDMA1 -Confirm:$false
New-NetIPAddress -InterfaceAlias RDMA1 -IPAddress 192.168.101.11 -PrefixLength 24
Set-DnsClientServerAddress -InterfaceAlias RDMA1 -ServerAddresses 192.168.100.10

#
# Rename RDMA2, set to manual IP address, configure IP Address, DNS
#
Get-NetAdapter -InterfaceDescription "*IPoIB*" | ? {$_.Name -ne "RDMA1"} | Rename-NetAdapter -NewName RDMA2
Set-NetIPInterface -InterfaceAlias RDMA2 -DHCP Disabled
Remove-NetIPAddress -InterfaceAlias RDMA2 -Confirm:$false
New-NetIPAddress -InterfaceAlias RDMA2 -IPAddress 192.168.102.11 -PrefixLength 24
Set-DnsClientServerAddress -InterfaceAlias RDMA2 -ServerAddresses 192.168.100.10

#
# Join Domain, restart the machine
#
Add-Computer -DomainName FST2.TEST -Credential (Get-Credential) -Restart

#
# Install File Server
#
Install-WindowsFeature File-Services, FS-FileServer, Failover-Clustering
Install-WindowsFeature RSAT-Clustering -IncludeAllSubFeature

#
# Start iSCSI Software Initiator
#
Set-Service MSiSCSI -StartupType automatic
Start-Service MSiSCSI

#
# Configure iSCSI Software Initiator
#

New-iSCSITargetPortal -TargetPortalAddress 192.168.101.10
Get-iSCSITarget | Connect-iSCSITarget
Get-iSCSISession | Register-iSCSISession

#
# Configure the five iSCSI LUNs (initialize, create partition, volume, format as drives J: to N:
#
1..5 | % { 
    $Letter ="JKLMN"[($_-1)]
    Set-Disk -Number $_ -IsReadOnly 0
    Set-Disk -Number $_ -IsOffline 0
    Initialize-Disk -Number $_ -PartitionStyle MBR
    New-Partition -DiskNumber $_ -DriveLetter $Letter -UseMaximumSize 
    Initialize-Volume -DriveLetter $Letter -FileSystem NTFS -Confirm:$false
}

5. Steps to configure FST2-FS2 (File Server 2)

#
# Set service power profile
#
POWERCFG.EXE /S SCHEME_MIN 

#
# Configure all 4 interfaces (1 DHCP, 3 static)
#

#
# Rename External, no further action required, since this is DHCP
#
Get-NetAdapter -InterfaceDescription "*Intel*" | Rename-NetAdapter -NewName "External"

#
# Rename Internal, set to manual IP address, configure IP Address, DNS
#
Get-NetAdapter -InterfaceDescription "*Realtek*" | Rename-NetAdapter -NewName "Internal"
Set-NetIPInterface -InterfaceAlias Internal -DHCP Disabled
Remove-NetIPAddress -InterfaceAlias Internal -Confirm:$false
New-NetIPAddress -InterfaceAlias Internal -IPAddress 192.168.100.12 -PrefixLength 24
Set-DnsClientServerAddress -InterfaceAlias Internal -ServerAddresses 192.168.100.10

#
# Rename RDMA1, set to manual IP address, configure IP Address, DNS
#
Get-NetAdapter -InterfaceDescription "*IPoIB*" | Select -Last 1 | Rename-NetAdapter -NewName RDMA1
Set-NetIPInterface -InterfaceAlias RDMA1 -DHCP Disabled
Remove-NetIPAddress -InterfaceAlias RDMA1 -Confirm:$false
New-NetIPAddress -InterfaceAlias RDMA1 -IPAddress 192.168.101.12 -PrefixLength 24
Set-DnsClientServerAddress -InterfaceAlias RDMA1 -ServerAddresses 192.168.100.10

#
# Rename RDMA2, set to manual IP address, configure IP Address, DNS
#
Get-NetAdapter -InterfaceDescription "*IPoIB*" | ? {$_.Name -ne "RDMA1"} | Rename-NetAdapter -NewName RDMA2
Set-NetIPInterface -InterfaceAlias RDMA2 -DHCP Disabled
Remove-NetIPAddress -InterfaceAlias RDMA2 -Confirm:$false
New-NetIPAddress -InterfaceAlias RDMA2 -IPAddress 192.168.102.12 -PrefixLength 24
Set-DnsClientServerAddress -InterfaceAlias RDMA2 -ServerAddresses 192.168.100.10

#
# Join Domain
#
Add-Computer -DomainName FST2.TEST -Credential (Get-Credential) -Restart

#
# Install File Server
#
Install-WindowsFeature File-Services, FS-FileServer, Failover-Clustering
Install-WindowsFeature RSAT-Clustering -IncludeAllSubFeature

#
# Start iSCSI Software Initiator
#
Set-Service MSiSCSI -StartupType automatic
Start-Service MSiSCSI

#
# Configure iSCSI Software Initiator
#
New-iSCSITargetPortal -TargetPortalAddress 192.168.101.10
Get-iSCSITarget | Connect-iSCSITarget
Get-iSCSISession | Register-iSCSISession

#
# No need to configure LUNs here. In a cluster, this is done only from one of the nodes. We did it in FS1.
#

6. Steps to configure FST2-HV1 (Hyper-V host 1)

#
# Set service power profile
#
POWERCFG.EXE /S SCHEME_MIN 

#
# Configure all 4 interfaces (1 DHCP, 3 static)
#

#
# Rename External, no further action required, since this is DHCP
#
Get-NetAdapter -InterfaceDescription "*82566DM*" | Rename-NetAdapter -NewName "External"

#
# Rename Internal, set to manual IP address, configure IP Address, DNS
#
Get-NetAdapter -InterfaceDescription "*PRO/100*" | Rename-NetAdapter -NewName "Internal"
Set-NetIPInterface -InterfaceAlias Internal -DHCP Disabled
Remove-NetIPAddress -InterfaceAlias Internal -Confirm:$false
New-NetIPAddress -InterfaceAlias Internal -IPAddress 192.168.100.13 -PrefixLength 24
Set-DnsClientServerAddress -InterfaceAlias Internal -ServerAddresses 192.168.100.10

#
# Rename RDMA1, set to manual IP address, configure IP Address, DNS
#
Get-NetAdapter -InterfaceDescription "*IPoIB*" | Select -Last 1 | Rename-NetAdapter -NewName RDMA1
Set-NetIPInterface -InterfaceAlias RDMA1 -DHCP Disabled
Remove-NetIPAddress -InterfaceAlias RDMA1 -Confirm:$false
New-NetIPAddress -InterfaceAlias RDMA1 -IPAddress 192.168.101.13 -PrefixLength 24
Set-DnsClientServerAddress -InterfaceAlias RDMA1 -ServerAddresses 192.168.100.10

#
# Rename RDMA2, set to manual IP address, configure IP Address, DNS
#
Get-NetAdapter -InterfaceDescription "*IPoIB*" | ? {$_.Name -ne "RDMA1"} | Rename-NetAdapter -NewName RDMA2
Set-NetIPInterface -InterfaceAlias RDMA2 -DHCP Disabled
Remove-NetIPAddress -InterfaceAlias RDMA2 -Confirm:$false
New-NetIPAddress -InterfaceAlias RDMA2 -IPAddress 192.168.102.13 -PrefixLength 24
Set-DnsClientServerAddress -InterfaceAlias RDMA2 -ServerAddresses 192.168.100.10

#
# Install Hyper-V
#
Install-WindowsFeature Hyper-V, Hyper-V-PowerShell, Hyper-V-Tools, Failover-Clustering
Install-WindowsFeature RSAT-Clustering -IncludeAllSubFeature

#
# Join Domain, restart
#
Add-Computer -DomainName FST2.Test -Credential (Get-Credential) –Restart

 

7. Steps to configure FST2-HV2 (Hyper-V host 2)

#
# Set service power profile
#
POWERCFG.EXE /S SCHEME_MIN 

#
# Configure all 4 interfaces (1 DHCP, 3 static)
#

#
# Rename External, no further action required, since this is DHCP
#
Get-NetAdapter -InterfaceDescription "*82566DM*" | Rename-NetAdapter -NewName "External"

#
# Rename Internal, set to manual IP address, configure IP Address, DNS
#
Get-NetAdapter -InterfaceDescription "*PRO/100*" | Rename-NetAdapter -NewName "Internal"
Set-NetIPInterface -InterfaceAlias Internal -DHCP Disabled
Remove-NetIPAddress -InterfaceAlias Internal -Confirm:$false
New-NetIPAddress -InterfaceAlias Internal -IPAddress 192.168.100.14 -PrefixLength 24
Set-DnsClientServerAddress -InterfaceAlias Internal -ServerAddresses 192.168.100.10

#
# Rename RDMA1, set to manual IP address, configure IP Address, DNS
#
Get-NetAdapter -InterfaceDescription "*IPoIB*" | Select -Last 1 | Rename-NetAdapter -NewName RDMA1
Set-NetIPInterface -InterfaceAlias RDMA1 -DHCP Disabled
Remove-NetIPAddress -InterfaceAlias RDMA1 -Confirm:$false
New-NetIPAddress -InterfaceAlias RDMA1 -IPAddress 192.168.102.14 -PrefixLength 24
Set-DnsClientServerAddress -InterfaceAlias RDMA1 -ServerAddresses 192.168.100.10

#
# Disable RDMA2, since this system only uses one RDMA interface
#
Get-NetAdapter -InterfaceDescription "*IPoIB*" | ? {$_.Name -ne "RDMA1"} | Rename-NetAdapter -NewName RDMA2
Disable-NetAdapter -InterfaceAlias RDMA2 -Confirm:$false

#
# Install Hyper-V
#
Install-WindowsFeature Hyper-V, Hyper-V-PowerShell, Hyper-V-Tools, Failover-Clustering
Install-WindowsFeature RSAT-Clustering -IncludeAllSubFeature

#
# Join Domain, restart
#
Add-Computer -DomainName FST2.Test -Credential (Get-Credential) -Restart

 

8. Steps to configure the Cluster FST2-FSC (run from FST2-FS1)

#
# Run Failover Cluster Validation
#
Test-Cluster -Node FST2-FS1, FST2-FS2

#
# Create cluster
#
New-Cluster –Name FST2-FSC -Node FST2-FS1, FST2-FS2

#
# Rename Networks
#
(Get-ClusterNetwork | ? {$_.Address -like "192.168.100.*" }).Name = "Internal"
(Get-ClusterNetwork | ? {$_.Address -like "192.168.101.*" }).Name = "RDMA1"
(Get-ClusterNetwork | ? {$_.Address -like "192.168.102.*" }).Name = "RDMA2"
(Get-ClusterNetwork | ? {$_.Address -like "172.*" }).Name = "External"

#
# Configure Cluster Network Roles (0=Not used, 1=Cluster only, 3=Cluster+Clients)
#
(Get-ClusterNetwork Internal).Role = 3
(Get-ClusterNetwork RDMA1).Role = 3
(Get-ClusterNetwork RDMA2).Role = 3
(Get-ClusterNetwork External).Role = 1

#
# Rename Witness Disk
#
$w = Get-ClusterResource | ? { $_.OwnerGroup -eq "Cluster Group" -and $_.ResourceType -eq "Physical Disk"}
$w.Name = "WitnessDisk"

 

9. Steps to configure the Classic File Server Cluster FST2-FS (run from FST2-FS1):

#
# Move all disks to node one, rename Cluster Disks
#
Get-ClusterGroup | Move-ClusterGroup -Node FST2-FS1
(Get-Volume -DriveLetter I | Get-Partition | Get-Disk | Get-ClusterResource).Name = "FSDisk1"
(Get-Volume -DriveLetter J | Get-Partition | Get-Disk | Get-ClusterResource).Name = "FSDisk2"

#
# Create a classic file server resource group
#
Add-ClusterFileServerRole -Name FST2-FS -Storage FSDisk1, FSDisk2 –StaticAddress 192.168.100.22/24, 192.168.101.22/24, 192.168.102.22/24

#
# Create Folders
#
Move-ClusterGroup -Name FST2-FS -Node FST2-FS1
md I:\VMS
md J:\VMS

#
# Create File Shares
#
New-SmbShare -Name VMS1 -Path I:\VMS -FullAccess FST2.Test\Administrator, FST2.Test\FST2-HV1$, FST2.Test\FST2-HV2$
New-SmbShare -Name VMS2 -Path J:\VMS -FullAccess FST2.Test\Administrator, FST2.Test\FST2-HV1$, FST2.Test\FST2-HV2$

#
# Set NTFS permissions
#
(Get-SmbShare VMS1).PresetPathAcl | Set-Acl
(Get-SmbShare VMS2).PresetPathAcl | Set-Acl

 

10. Steps to configure the Scale-Out File Server Cluster FST2-SO (run from FST2-FS1):

#
# Add two remaining disks to Cluster Shared Volumes
#
Get-ClusterResource | ? OwnerGroup -eq "Available Storage" | Add-ClusterSharedVolume

#
# Create a scale out file server resource group
#
Add-ClusterScaleOutFileServerRole -Name FST2-SO

#
# Create Folders
#
MD C:\ClusterStorage\Volume1\VMS
MD C:\ClusterStorage\Volume2\VMS

#
# Create File Shares
#
New-SmbShare -Name VMS3 -Path C:\ClusterStorage\Volume1\VMS -FullAccess FST2.Test\Administrator, FST2.Test\FST2-HV1$, FST2.Test\FST2-HV2$
New-SmbShare -Name VMS4 -Path C:\ClusterStorage\Volume2\VMS -FullAccess FST2.Test\Administrator, FST2.Test\FST2-HV1$, FST2.Test\FST2-HV2$

#
# Set NTFS permissions
#
(Get-SmbShare VMS3).PresetPathAcl | Set-Acl
(Get-SmbShare VMS4).PresetPathAcl | Set-Acl

 

11. Steps to configure the VMs in FST2-HV1

#
# Create VM Switch (if doing this remotely, you will need to reconnect)
#
New-VMSwitch -NetAdapterName External -Name External
Get-NetAdapter -InterfaceDescription Hyper* | Rename-NetAdapter -NewName ExternalVirtual

#
# Create VHD files for two VMs
#
New-VHD -Path \\FST2-FS\VMS1\VM1.VHDX -Fixed -SizeBytes 20GB
New-VHD -Path \\FST2-SO\VMS3\VM3.VHDX -Fixed -SizeBytes 20GB

#
# Create two VMs
#
New-VM -Path \\FST2-FS\VMS1 -Name VM1 -VHDPath \\FST2-FS\VMS1\VM1.VHDX -SwitchName External -Memory 1GB
New-VM -Path \\FST2-SO\VMS3 -Name VM3 -VHDPath \\FST2-SO\VMS3\VM3.VHDX -SwitchName External -Memory 1GB
Set-VMDvdDrive -VMName VM1 -Path D:\WindowsServer2012.iso
Set-VMDvdDrive -VMName VM3 -Path D:\WindowsServer2012.iso
Start-VM VM1, VM3

 

12. Steps to configure the VMs in FST2-HV2:

#
# Create VM Switch (if doing this remotely, you will need to reconnect)
#
New-VMSwitch -NetAdapterName External -Name External
Get-NetAdapter -InterfaceDescription Hyper* | Rename-NetAdapter -NewName ExternalVirtual

#
# Create VHD files for two VMs
#
New-VHD -Path \\FST2-FS\VMS2\VM2.VHDX -Fixed -SizeBytes 20GB
New-VHD -Path \\FST2-SO\VMS4\VM4.VHDX -Fixed -SizeBytes 20GB

#
# Create and start two VMs
#
New-VM -Path \\FST2-FS\VMS2 -Name VM2 -VHDPath \\FST2-FS\VMS2\VM2.VHDX -SwitchName External -Memory 1GB
New-VM -Path \\FST2-SO\VMS4 -Name VM4 -VHDPath \\FST2-SO\VMS4\VM4.VHDX -SwitchName External -Memory 1GB
Set-VMDvdDrive -VMName VM2 -Path D:\WindowsServer2012.iso
Set-VMDvdDrive -VMName VM4 -Path D:\WindowsServer2012.iso
Start-VM VM2, VM4

 

13. Steps to create a Hyper-V Cluster using file share storage

#
# on FST2-HV1
#

#
# Create Hyper-V Cluster called FST2-HVC
#
New-Cluster –Name FST2-HVC -Node FST2-HV1, FST2-HV2

#
# on FST2-FS1
#

#
# Create Folder and File Share for File Share Witness
#
MD C:\ClusterStorage\Volume1\Witness
New-SmbShare -Name Witness -Path C:\ClusterStorage\Volume1\Witness -FullAccess FST2.Test\Administrator, FST2.Test\FST2-HVC$
(Get-SmbShare Witness).PresetPathAcl | Set-Acl

#
# on FST2-HV1
#

#
# Configure FST2-HVC Cluster with a File Share Witness
#
Set-ClusterQuorum -NodeAndFileShareMajority \\FST2-SO\Witness

#
# Make VMs in FST2-HV1 Highly available
#
Add-VMToCluster VM1
Add-VMToCluster VM3

#
# on FST2-HV2
#

#
# Make VMs in FST2-HV2 Highly available
#
Add-VMToCluster VM2
Add-VMToCluster VM4

 

14. Optional: Steps to create a nonclustered file share on FST2-FS1

#
# on FST2-FS1
#
MD D:\VMS
New-SmbShare -Name VMS5 -Path D:\VMS -FullAccess FST2.Test\Administrator, FST2.Test\FST2-HV1$, FST2.Test\FST2-HV2$
(Get-SmbShare VMS5).PresetPathAcl | Set-Acl

#
# on FST2-HV1
#
New-VHD -Path \\FST2-FS1\VMS5\VM5.VHDX -Fixed -SizeBytes 20GB
New-VM -Path \\FST2-FS1\VMS5 -Name VM5 -VHDPath \\FST2-SO\VMS3\VM3.VHDX -SwitchName External -Memory 1GB
Set-VMDvdDrive -VMName VM5 -Path D:\WindowsServer2012.iso
Start-VM VM5

 

15. Conclusion

Sorry for the somewhat terse post, written mostly in PowerShell instead of English :-).
I hope you enjoy the PowerShell scripting and try at least some of it in your configurations.
For additional test scenarios you could try on a Hyper-V over SMB setup, see this previous blog post.

Comments

  • Anonymous
    January 01, 2003
    Hi Jose,absolutely great, Windows Server 2012 and the new CMDLETs makes us a lot easier to implement ! great examples to configure nic's or create automatically an AD or VMs !  fantastic .  Windows Server 2012 - Developer Team , great Job ! and thank you Jose for These blog post.RG Steffen (WS2012  - RDP Member)
  • Anonymous
    August 24, 2012
    Great Post! Thanks for taking the time to go through this and really spell it out. Awesome guide. /CB
  • Anonymous
    August 30, 2012
    Thank you for the post. This has motivated me to source all the hardware and give this a go!
  • Anonymous
    September 05, 2012
    Very nice!