Protected Network|Powershell

Hi, folks!

Protected Network is turned on by default for every VMs in 2012 R2. To control this option you can use GUI and Powershell.

It’s very simple to find “switch” in GUI,

hv_protected_1

but you may be a little bit confused during searching “protected network” value in powershell.

For example,

PS C:\Windows\system32> Get-VM -VMName SC_VMMR2|Get-VMNetworkAdapter|fl *


IovWeight                : 0
IovQueuePairsRequested   : 1
IovQueuePairsAssigned    :
IovInterruptModeration   : Default
IovUsage                 :
ClusterMonitored         : True
VirtualFunction          :
IsLegacy                 : False
IsManagementOs           : False
IsExternalAdapter        : False
Id                       : Microsoft:1A5B79A6-EDCA-47A0-B023-E21139DFDB96\AE7DB00D-E40F-4FE2-ABA3-C57C1EB7A081
AdapterId                :
DynamicMacAddressEnabled : True
MacAddress               : 00155D191E06
MacAddressSpoofing       : Off
SwitchId                 :
Connected                : False
PoolName                 : Primordial
SwitchName               :
AclList                  : {}
ExtendedAclList          : {}
IsolationSetting         : Microsoft.HyperV.PowerShell.VMNetworkAdapterIsolationSetting
CurrentIsolationMode     : Vlan
RoutingDomainList        : {}
DhcpGuard                : Off
RouterGuard              : Off
PortMirroringMode        : None
IeeePriorityTag          : Off
VirtualSubnetId          : 0
DynamicIPAddressLimit    : 0
StormLimit               : 0
AllowTeaming             : Off
VMQWeight                : 100
IPsecOffloadMaxSA        : 512
VmqUsage                 :
IPsecOffloadSAUsage      :
VFDataPathActive         : False
VMQueue                  :
MandatoryFeatureId       : {}
MandatoryFeatureName     : {}
VlanSetting              : Microsoft.HyperV.PowerShell.VMNetworkAdapterVlanSetting
BandwidthSetting         :
BandwidthPercentage      : 0
TestReplicaPoolName      :
TestReplicaSwitchName    :
StatusDescription        :
Status                   :
IPAddresses              : {}
ComputerName             : HV01
Name                     : Network Adapter
IsDeleted                : False
VMId                     : 1a5b79a6-edca-47a0-b023-e21139dfdb96
VMName                   : SC_VMMR2
VMSnapshotId             : 00000000-0000-0000-0000-000000000000
VMSnapshotName           :
Key                      :

Err..where is the value for Protected Network?Улыбка

Ok. Let’s begin from what is really protected network (PN). PN adds to Hyper-V  Cluster an ability to monitor a network health for every vNICs and moves VMs to another Hyper-V node if a network disconnection is detected. = it’s a really cluster monitoring option.

To change settings of vNICs we have to use Set-VMNetworkAdapter cmdlet:

I’m dummy and want to get some help:

Get-Help Set-VMNetworkAdapter -Detailed

..

 -NotMonitoredInCluster <bool>

..

hmm..is it what we are looking for?

Let’s try to apply some changes.

Get-VM -VMName SC_VMMR2|Set-VMNetworkAdapter -NotMonitoredInCluster $True

Get-VM -VMName SC_VMMR2| Get-VMNetworkAdapter|fl *

..
ClusterMonitored         : False
..

Check in GUI:

hv_protected_2

And finally we found what we wanted.

Sometimes (err..I mean always) we need to really understand what this feature provides and how it works.

Links:

http://blogs.msdn.com/b/virtual_pc_guy/archive/2014/03/11/protected-networks-in-windows-server-2012-r2.aspx

How to manually merge snapshots in Hyper-V

There are lot of articles similar with that. Ok. This is a only just my recent experience

I have VM with only one AVHD (snapshot/checkpoint) . If your VM has a lot of AVHD files , you need to locate the latest.

For example, you have 3 snapshots for VM (VHD <> AVHD1<> AVHD2 <> AVHD3) .

VHD is the parent disk for AVHD1, AVHD1 is the parent for AVHD2 and AVHD2 is the parent for AVHD3.

Merging process: AVHD3 to AVHD2, AVHD2 to AVHD1 , AVHD1 to VHD

In my case I have only AVHD1 and parent VHD (on the picture below)

snapshots_merge_1

View (for 2012/2012R2, folder properties 2008/2008R2) –> activate “File Name Extensions” and change AVHD extension  to VHD

snapshots_merge_2

snapshots_merge_3

Go to Hyper-V Manager , click on Edit Disk on the right pane , Browse and locate your checkpoint (.vhd)

snapshots_merge_4

snapshots_merge_5

Click on the Next and choose Merge

snapshots_merge_6

Merge the changes to the parent virtual disk

snapshots_merge_7

Click “Finish”

snapshots_merge_8

snapshots_merge_9

Result:

snapshots_merge_10

Merging AVHD to VHD is completed.Now you can use this merged VHD disk during VM creation.