Building a Hyper-V Environment for SharePoint Prototype – Part 1

NOTE: This post has been published before but I had to make a few changes and re-publish it (the changes didn’t affect the flow at all, they were just around some of the introductory wording). So if you think you’ve seen this before, you probably have. 🙂

One of the areas I’ve been investigating as a technical architect at archTIS is to provide attribute based access control (ABAC) access to documents stored in SharePoint. It’s an area we haven’t tested at all before, so it was important to build a prototype environment to satisfy ourselves that it really does work the way we want it to. In this post, I’ll be looking specifically at the very first part of the prototype building, creating the Hyper-V environment.

Initial Configuration

Those of you that have been following this blog for some time will know that until fairly recently I worked for Oracle Corporation, so my experience has largely been with VirtualBox. Of course, VirtualBox and Hyper-V do not play well together – in fact, they don’t play together at all. You can either have one running or the other. You can switch from using one to the other, but switching requires a Windows reboot. It’s a pretty easy switch. You just need to go to the optional features function to switch. That can be done either by:

  • Starting the Control Panel, then clicking on “Program and Features”, then clicking “Turn Windows features on or off”
  • Right click on the Windows button in the bottom left corner of the task bar, click “run”, and then type “optionalfeatures” and click “OK”

If Hyper-V is already selected with a tick in the box as shown below, you’re good to continue. If it’s not selected, tick the box and click “OK”:

If you have toggled the selection either way, you will need to reboot your machine (Windows will tell you this as well).

Creating a Hyper-V Virtual Machine

Now that we’ve enabled Hyper-V, the next step is to create a Hyper-V virtual machine. That’s done in Hyper-V Manager (if you can’t find it, just search for “Hyper-V” and then pin it to your taskbar if you’re going to use it regularly). In my nice pristine environment, this is the first Hyper-V virtual machine I have created, and I can simply click on “New” then “Virtual Machine”:

On the first step of the “New Virtual Machine Wizard”, provide a name and optionally a location for the virtual machine to be stored. In my configuration, my D drive is an SSD rather than a normal disk so I run the virtual machines from there:

On the second step of the wizard, choose “Generation 2” (mainly because the entire environment will be 64 bit) and click “Next”:

On the next step, increase the startup memory to 10,240 Mb and click “Next” (NOTE: you can increase this to 16 Gb for the complete SharePoint install):

On the next page, I can’t configure any networking because I haven’t set up any virtual switches (we’ll come back to how to fix that later), so just click “Next”:

On the Connect Virtual Hard Disk screen, drop the size of the hard disk to 30 Gb and click “Next” (again, for the complete SharePoint install you should increase this to something more like 200 Gb):

On the Installation Options screen, change to “Install an operating system from a bootable image file, select the path to your Windows Server 2012 ISO file and click “Next”:

Finally, click on “Finish”:

You’ll be returned to the Hyper-V Manager where you can now see your newly added virtual machine:

Loading the Operating System

Of course, all this has done so far is to create a VM – there is no operating system loaded or (obviously) anything else. I told the VM where to get its OS from (the Windows Server 2012 ISO file), but it hasn’t actually loaded that yet. So now we need to start the VM so it will load the OS. To do that, double click the VM name in the list of virtual machines:

You’ll see a message that no operating system has been loaded. If you click any key to retry, you’ll then see a message “Press any key to boot from CD or DVD …” If you press any key again, then it will find the ISO file you told it to load. In my case, I’m loading Windows Server 2012 R2 so the screen now asks me for language, time and currency format and keyboard preferences:

For my installation, I’m happy with the defaults so I just click “Next” which brings up the screen to start installing:

On the next screen, I’m asked for the product key to activate Windows, so I enter that and click “Next”:

This particular ISO allows me to choose either a Server Core Installation or a Server with a GUI. I want the latter so I choose that and click “Next”:

I’m then prompted to accept the license terms, so I do that and click “Next” again:

I’m prompted for the type of installation I want. In my case, I want a Windows only installation so I choose the second option (note that the first option is selected by default, so since there is no “Next” button on the screen I can’t show you a screenshot of the second option being selected as doing so progresses to the next screen immediately):

Next, I’m asked where I want to install Windows. There is only one drive available in this setup, so I can just click “Next”:

Finally, the installation starts:

When Windows is finished installing, it will needs to restart the VM:

When the VM restarts, you’ll be asked to enter a password for the Administrator account:

And that’s the end of installing the OS.

Fixing the Lack of Network Issue

You may recall from the beginning part of this post that there was no network connection available. That was because I made newbie mistake number 12, and I hadn’t created any virtual switches. It’s easy enough to address after you’ve created the VM. Here’s how it’s done. Firstly, turn the VM off by clicking the third button from the left on the VM connection:

You may be asked if you want to turn off this virtual machine. Click “Turn Off” to confirm the action:

Now you can close the VM connection window by clicking the cross in the top right corner of the screen. Back on the Hyper-V Manager screen, click “Virtual Switch Manager” in the top right pane:

You’ll notice there are three virtual switch types you can create. The only one we need for this situation is the external switch, but you might as well create all three so we don’t fall into this problem again if we need either of the other two in future. I’m just going to walk through creating the external switch in this demo. Since “External” is already selected, click on “Create Virtual Switch”:

On the next screen, provide a name (I’ve imaginatively used “External Switch”), and select the correct network card in your PC, then click “OK”:

You’ll receive a message that pending changes may disrupt network activity. Click “Yes” to continue:

When the system finishes applying changes, you can do the same for the other two switch types, private and internal. Those aren’t needed for what I’m doing so I’ve left that process as an exercise for you to do if you want. 🙂

Now we need to add that network switch to our VM. To do that, , select your VM then click on “Settings” in the bottom right pane in Hyper-V Manager:

On the right hand side you can see you can add hardware. Select “Network Adapter” from the list then click “Add”:

Select the “External Switch” you just created from the dropdown list of virtual switches. IMPORTANT: If it is selected, de-select “Enable virtual LAN identification”. Then click “OK”:

Back on the Hyper-V Manager, double-click the virtual machine then click the “Start” button (or select “Start” from the Action menu) to start it:

When the VM starts, you can login as Administrator again and then network should be started. You should be prompted to find PCs and other devices. Click “Yes” and you’re done! You now have a functioning Windows Server 2012 R2 VM (provided that was the ISO you told it to boot from).

Pete

After 22 years of working at Oracle in just about every role except Marketing and Support, I am now working as a Senior Managed Services Consultant with Red Stack Tech, specializing in Oracle Database technology, High Availability and Disaster Recovery solutions.

I am also a member of the OakTable Network, and have presented at RMOUG Training Days, Hotsos Symposia, Oracle OpenWorld conferences, and other user group events. I have co-authored the Expert Oracle Enterprise Manager 12c and Practical Oracle Database Appliance books published by Apress, and am one of the authors of the Building Database Clouds in Oracle Database 12c book published by Addison Wesley.

Leave a Reply

Your email address will not be published. Required fields are marked *