Server 2008 R2 VM Guest on Hyper-V: vNIC defaults to Public Network instead of Domain

This morning, after a reboot, one of my 2k8VMs decided that it was no longer on the domain and couldn't find any domain controllers, therefore it defaulted to a Public Network for the NIC.

This had the unfortunate effect of rejecting all traffic sent its way.

I did some quick searching, but it appears that my Google-Foo is not strong at 8am before coffee and I came up blank.

I managed to resolve this by logging into the virtual console through Hyper-V manager and change the settings on the NIC to enable DHCP and grab an IP address. This immediately saw everything again and happily reported to be on the domain with internet access.

I then reset the NIC to a static IP (the same details as before), which it held and maintained its ability to talk to the domain.

Why? I dont know... anyone?

Xen VM exported to Hyper-V has no internet connectivity

This weekend I began migrating some servers from a Xen Server to a Hyper-V server.

The process was pretty straight forward, as I had tested this, the week before, in the lab environment.

  1. using Xen Center, Power off the VM and export the server. Ensure to not select the 'one file' option.
  2. Open the export folder when complete, and copy (and rename) the vhd file
  3. Create the new VM on the Hyper-V server and attach the exported disk
  4. Power up
  5. Uninstall Xen Tools
  6. Reboot
  7. Install Hyper-V Guest tools
  8. Rub hands gleefully.

It was during the last phase that I ran into a roadblock. Obviously there was a change of hardware, requiring a reboot. The problem was, that once it was up, there was no internet connectivity. I was able to do anything on the LAN. I was also able to get dns lookups for external addresses, but I couldnt get traffic out of the LAN from this server.

The issue, it turned out, was that during the addition of the Hyper-V NIC, a persistent Route was added for using the NIC as the gateway.

In a command window, use ROUTE PRINT to see your routing table.

the solution, was to remove this persistent route;

route delete

and re-add it with the correct gateway;

route add mask <gateway ip>


Gotchya When Connecting to HyperV from Windows 8 Non Domain Computer

A short note that will hopefully save someone else the hours it took me to find this nugget on a Microsoft Forum.

When Connecting to a HyperV server, make sure that you are using a local account on the Windows8 machine, not the default "MicrosoftAccount" in the form of With the latter you will keep hitting an Access denied error when trying to remotely manage the firewall through the GUI.

Thanks to a3uit for pointing that out in the comments.

Configuring Remote Management Access for Hyper-V

[NOTE: This article still under development]

One of the big things about Hyper-V, is that although it is a Windows Server and capable of being domain joined, in some cases, you might not want to join a domain. (eg. a small business with one Hyper-V server. If the DC is on the Hyper-V server, then you may run the risk of not being able to connect to it, in the event that the DC guest doesn't start.)

In these cases, I prefer to leave the Hyper-V in a workgroup, however this makes managing it a little more interesting to configure.

Essentially the process is;

  • Install the Hyper-V management tool from the Windows Features or the Microsoft Windows Server RSAT
  • Add the HyperV server to the local client HOSTS file
  • Configure Clients Component Service
    • Start > Run > DCOMCNFG
    • In console open Components > Computers, > right click on ‘My Computer’.
    • Select the ‘Com Security’ tab and under ‘Access Permissions’ select ‘Edit Limits’.
    • Select the line that says ‘ANONYMOUS LOGON’, C
    • Check the box "Remote Access" under Allow.
  • Add credentials for the server using cmdkeyunder command prompt
    • cmdley /add:Servername /user:Username /pass:Password4ThatUser
  • on the server, enable Remote Management from the SCONFIG menu
    • Allow MMC Remote Managment
    • Allow PowerShell
    • Reboot Server
    • Allow Server Manager Remote Management
  • on the server, run the following firewall rule updates;
    • Enable-NetFirewallRule -DisplayGroup "Remote Administration"


Be aware of this if using Windows 8 client (I spent hours troubleshooting this).

Make sure that you are using a local account on the Windows8 machine, not the default "MicrosoftAccount" in the form of With the latter you will keep hitting an Access denied error when trying to remotely manage the firewall through the GUI.

Thanks to a3uit for pointing this out on the Microsoft forums.

Other Useful Sites:

Configure remote management and setup HVRemote

Remote Management of Hyper V


Hyper-V PowerShell Commands

I just spent the evening working on a HyperV server, from the command line. I realized that I don't have a nice, one-place lookup for the comman commands I've been using. They are spread over a number of websites in my favourites bar. So, this is my one-stop reference for Hyper-V Powershell Commands. (Credit at the bottom)

Virtual Machines

New virtual machine

New-VM -Name Testmachine -path C:\vm-machine -MemoryStartupBytes 1024MB

New virtual disk

New-VHD -Path c:\vm-Machine\Testmahcine\Testmachine.vhdx -SizeBytes 60GB -Dynamic

Attach The Disk

Add-VMHardDiskDrive -VMName <name> -Path <path>

Add an ISO image to the Virtual Optical Drive

Set-VMDvdDrive -VMName <name> -ControllerNumber 1 -Path <path>

Add a new Network Adapter to the VM

Add-VMNetworkAdapter -VMName <name> -Name “Prod NIC” [-IsLegacy $true ]

Connect-VMNetworkAdapter -VMName <name> -SwitchName ‘Private Switch’

Set the Start policy for a VM

Set-VM -Name <name> -AutoStartAction Start

Virtual Machine Controls

Show all the VMs on the host


Starting it up:

Start-VM -Name <name>

Stopping the VM

Stop-VM -Name <name>

Take a snapshot of the VM

Checkpoint-VM -Name ProdServer* -SnapshotName PreMigrationSnapshot

Make a VM from a snapshot

Export-VMSnapshot -Name ‘PosUpdates’ -VMName NewVM -Path H:\NewVMfromSnapshot


Host Management

Add a virtual switch for the VMs

New-VMSwitch “External Switch” –NetAdapterName “Ethernet Connection” –AllowManagementOS $true

Get the RAM of the Host Hyper-V Server

(systeminfo | Select-String 'Total Physical Memory:').ToString().Split(':')[1].Trim()