t-SCVirtualMachine -Name HNVGateway1 #Iterate through each entry in the Hashtable ForEach ($Key in $NicNames. Keys) { #Find the Network Adapter's MAC Address in VMM that is connected to #the VM Network. As the Tenant Network Adapter is not attached to a #VM Network it must be dealt with carefully $VNAMacAddress = ($GatewayVM.VirtualNetworkAdapters Where-Object { #Check for an actual value if ($ VMNetwork.Name) { if ($.VMNetwork.Name -eq $key) { $True Creating the Gateway for Virtual Machine Communications #check for the Tenant NIC elseif ( ! ($ VMNetwork. Name) -and ! ($key) ) { $True }) MACAddress Invoke-Command -ComputerName $GatewayVM. ComputerName - ScriptBlock { Param ($LocalMacAddress, $NewNicName) #Change the format of the MAC Address $LocalMacAddress = $LocalMacAddress -replace ":"," #Find the NIC based on the MAC address obtained from VMM $NIC = Get-NetAdapter | Where-Object { $ . .MacAddress -eq $LocalMacAddress} #Get the WMI object based on the NIC's current name $wmi = Get-WmiObject -Class Win32_NetworkAdapter Filter "NetConnectionID = ""$($NIC.Name) "HU" #Change the NIC's name to the correct name $wmi.NetConnectionID = $NewNicName $wmi Put ( ) - -ArgumentList $VNAMacAddress, $NicNames. Item ($Key) 46. In the VMM console, click on the Home tab in the ribbon bar and click on the PowerShell button. This will launch PowerShell with the VMM module already loaded and the console connected to the current VMM instance. In the PowerShell console, execute the script file saved in the previous step. 47. Once the PowerShell script is complete, navigate to VMs and Services I All Hosts and click on the host that has the HNVGateway1 VM deployed. 48. Right-click on the HNVGateway1.VM, navigate to Connect or View, and click on Connect via Console. 49. Log in if necessary. Open a command prompt and run ipconfig. You will see the names of the Ethernet adapters have changed, as shown in the following screenshot: Chapter 3 Windows IP Configuration Ethernet adapter External: Connection-specific DNS Suffix Link-local IPv6 