(FYI...I have no pictures with this post.  I did... but I lost them.   ...yup.

So I’m working remotely, virtualizing a Windows Server 2003 R2 (Dell OEM) onto a Windows Server 2012 R2 Hyper-V Host.  Because the server is virtualized, Windows needs to re-activate.  Since you cannot log into a 2003 Server without being activated, you end up in a catch twenty-two with regards to the “Activate or Shutdown” prompts.

Because I am dealing with two identical servers on the same subnet, I need to keep both separate.  How can I connect the VM to the Internet without conflicting with the physical server AND without an iDRAC or LOM card present in the physical server?  (Remember…I am remotely working.  Using LogMeIn to manage the physical server.)

My solution was to create a way to disable the network adapter on the physical server for a period of time, then re-enabling without user interaction.  During the time the network adapter was disabled, I could connect the VM network adapter and activate the server.  I did this by creating BAT files and using Task Scheduler.

Three BAT files were created:  DisableNIC.bat, EnableNIC.bat, and ShutdownServer.bat. 

Three Scheduled Tasks were created on the physical server, one for each BAT file.  The tasks we triggered as “One-Time Only”. 

Scheduling the network adapter to disable at say 1:00am and then to enable at 1:40am same day, I gave myself a window of forty minutes in which I could connect the VM to the Internet, activate with a valid Product Key with Microsoft, and install Hyper-V Integration Tools.  Once I had the VM working, I disconnected the network adapter in Hyper-V prior to the physical server coming back online.

Once I was satisfied with the VM, I wanted to shut down the physical server.  I also did not want someone to power back on the physical server and cause an issue later.  Because this someone is sort-of technical, they know enough to go “reboot the box” when stuff stops working.  To ensure no harm later, I know added a Scheduled Task to shut down the server in between the “disable / enable”.  For example, Schedule the network adapter to become disabled at 2:00am, schedule the server to shut down at 2:02am.  Finally, schedule the network adapter to become enabled at 2:15am.  If the server stops responding to PING commands, even after 2:15am, you know the server is shut down.  If you messed up the shutdown script, the network adapter will become enabled and you can try again.

Here are the contents of the BAT files I used.  Simple stuff here:

                DisableNIC.bat = netsh interface set interface “Local Area Connection” DISABLED

                ShutdownServer.bat = shutdown /s /f /c "Virtualized" /f /d p:4:1

                EnableNIC.bat = netsh interface set interface "Local Area Connection" ENABLED

Remember, the tasks need to be executed one-time only with the highest elevation permission. 

When performing this, use a test server already in Hyper-V if possible.  Work out the bugs with your tasks / scripts on a computer you won’t lose access to regardless.