Installing Hyper-V Server Role on a Standalone Server

 

I recently had to rebuild my Windows Server 2008 laptop, a Dual Core Athlon X64, 2 GB of RAM  with hardware virtualization capabilites. I usually use this for demo’s implementations and for personal practice as well.

Hyper-V gives me a virtual environment where I can have networked guest operating system interacting even on the physical host. I love snapshots, I have fat fingers and when ever I misconfigured a test guest I can just roll back to its previous state.

 

 

 

 

 

Adding Hyper-V Server Role

On the server manager, Click Roles.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Then Click Add Roles and the add roles wizard appears.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

On the add roles wizard, click next >

 

 

On the Select Server Roles window, Select Hyper-V then click Next >

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Introduction to Hyper-V. There are some useful info in here, most of the basics are covered in this window. I suggest that we skim over those info here and bookmark important links. For now, lets click Next >

Let us not choose any network for now, we can configure our networks later.

On the confirm installation window, this summarizes our installation configuration. I would also suggest that we skim this page for any changes before we actually install the Hyper-V server role.

 

Hyper-V is being installed at this moment, after the wizard completes there is a prompt that a restart is pending, click close.  

 

You must restart to finish installing.

 

After a restart, the server would have a windows update. Then after logging on again, the configuration resumes.

 

There! Installation succeeded! Click close and your Hyper-V Server Role is now installed and ready to be used!

 

Before we create our first virtual machine, lets our virtual networks. (saves me a lot of time in the long run)

Go to the Server Manger, go to Roles then expand Hyper-V and the Hyper-V Manager and right click the Server Name and chose Virtual Network Manager.

 

On the Virtual Network Manager, I will going to create an Internal virtual network. Click Add.

Name your new Virtual Network then click Apply and OK.

Lets now create our first virtual machine!

On Server Manager, Click Roles then expand the tree to Hyper-V, Hyper-V manager then to the name of the server.

 

 

 

Right click the server name then click New Virtual machine..

 

On the Before You Begin window, click Next >

 

I’m installing a new virtual instance of a Window Server 2008, and I will save this on a different location.

 

to change the location, click Browse and browse thru the local file system and select the directory where you want to save your VM’s. I usually create my own folder for the virtual hard disk and virtual machine configurations. After finishing this, click Next >

   

How much RAM would we give the new virtual machine? Is 512 enough for a Windows Server 2008?

 

Choose network. We have already configured our Internal Network and for my demo’s and practices, I’m going to use this.

We would also need to create a new virtual hard disk for our virtual machine. So we need to choose Create a virtual hard disk. Click Next > if finished.

 

We can also install an operating system on upon boot of the Virtual Machine. We can choose from different media’s and I have a Windows Server 2008 ISO, I’ll gona be using this. Just browse thru the file system and select the ISO.

After selecting the ISO, click Next >

We are now presented with a summary and if we are finished reviewing, we can click Finish to begin the creation process.

Note : Notice that the Start the virtual machine after it is created box was not checked. Quoting a good mentor on Hyper-V, never make it a habit to start a newly created VM right after creation, specially on a production environment and if you are converting Physical to Virtual Machines.

 

After creating the VM. We can now boot the new VM!

On Server Manager, Click Roles, Expand to Hyper-V and Microsoft Hyper-V Manager and select the server name.

The virtual machine list comes up, you can boot the Windows Server 2008 VM by right click and click Start.

 

This doesn’t immediately let you view the server that is running, you can view it by right click then click Connect. 

And the hyper-v connection window appears and you are now installing a new Windows Server 2008 running on top of a Hyper-V!

Installing Microsoft Loopback Adapter on Windows Server 2008

Installing the loopback is really easy. Just go to the control panel and Open Add Hardware.

Wizard appears and you may click Next >.

On the selection on "What do you want the wizard to do?" Select Install the hardware that I manually select from a list (Advanced) then click Next >

On the list, scroll down to and select the Network Adapters then click Next >

Scroll down the Manufacturer list and select Microsoft then on the network adapter list, select Microsoft Loopback Adapter and click Next >

The wizard will now confirm to install the virtual hardware. Clicking Next > will start the installation process.

   

You can now click the Finish button.

While the control panel is open. its a good time to configure the new (virtual) network adapter. We can configure the new Network just like a physical network. Just go to Network and Sharing Center on control panel

On the Network and Sharing Center, click Manage network connections.

Find the Network connection with labels as Microsoft Loopback Adapter, right click, then choose properties.

On my virtual network, I will be using IPv4 only for now. Choose Internet Protocol Version 4 (TCP/IPv4), then click properties.

I’m using a static network, and I will use the 10.0.0.0/ 24 block. Using this series, I dont want to conflict the existing physical network :D.

On the General Tab, choose use the following IP address radio button. I will be using the 10.0.0.2 IP, my subnet mask is 255.255.255.0 and a dummy gateway of 10.0.0.1. Ill be using it self as the DNS server (127.0.0.1). Click Ok. Then close the wizard.

  

Getting all available network interface using NetworkInterface namespace

By using the NetworkInformation namespace
you can get all of the available network interfaces on the current machine.
http://msdn.microsoft.com/en-us/library/system.net.networkinformation.aspx
This is very useful for  applications that are network aware 
or that require to configure the network adapters.
 
using System.Net.NetworkInformation;
 
   1:  //Iterate to all available network interfaces
   2:  foreach (NetworkInterface netInterface in NetworkInterface.GetAllNetworkInterfaces())
   3:  {
   4:      // Filter to load only configurable interfaces
   5:      if (netInterface.NetworkInterfaceType == NetworkInterfaceType.Ethernet |
   6:           netInterface.NetworkInterfaceType == NetworkInterfaceType.Wireless80211)
   7:      {
   8:         //Use the ff as strings, add to a collection or a list
   9:          netInterface.Name.ToString();
  10:          netInterface.Description.ToString();
  11:      }
  12:  }

The above snippet came from a little project that I wrote for me and my Amy that configures our wireless and cabled adapters. Because we both have laptops that connects to both of our office wireless, LAN on their conference (no wireless signal there), wireless in the condo, wireless at Bataan (ssshhh its free, but we need to configure your DNS to SMART BRO :P, it seems that their neighbor has DHCP but did not configured / or has hidden the DNS) 

Sending data to and receiving data from a resource identified by a URI thru WebClient

 

As I have posted on msforums.ph about using a System.Net.WebClient to "Post" a Collection instead of posting this string postData = "client_id=" + 318 + "&tracking_id=" + 2000 thru HttpWebRequest. You can use this:

 
   1:  //Declare your Name-value Collection
   2:  System.Collections.Specialized.NameValueCollection objCollectionToPost = new NameValueCollection(2);
   3:   
   4:  //populate your collection
   5:   objCollectionToPost.Add(“client_id”, 318);
   6:   objCollectionToPost.Add(“tracking_id”, 2000);
   7:   
   8:  //Instantiate  your System.Net.WebClient
   9:  WebClient objClient = new WebClient();
  10:  objClient.BaseAddress = “https:/payment.example.com/gateway”; 
  11:   
  12:  //To capture the response, you may use a byte[ array or a long string, your implementation
  13:  //would depend on what you think is the response will be
  14:  // for this instance I will use a byte array (you will notice why siguro at the end)
  15:   
  16:  Byte objResponseCollection;
  17:   
  18:  //This is the actual posting, you would notice that when you UploadValues to the 
  19:  objResponseCollection = objClient.UploadValues(objClient.BaseAddress, "POST", objCollectionToPost);
  20:   
  21:  //since most likely it would be a length of bytes, and I know from the documentation of your payment
  22:   
  23:  //gateway, that this will be a “Comma Delimited” string, I will process it as follows
  24:   
  25:  String objRetValues;
  26:  objRetValues = System.Text.Encoding.ASCII.GetString(objResponseCollection).Split(",".ToCharArray());
 
When you post WebClient usually returns the response of the payment gateway. 
The response is usually a long string that you need to split into a specified delimiter. 
In my example I already know that the gateway will return a "Comma Delimited" String based on the documentation I got from the payment provider.
 
For more info on WebClient go to msdn: http://msdn.microsoft.com/en-us/library/system.net.webclient(VS.80).aspx
 
 
 
 
 

MCPD – Web Developer

Its finally there! Its on the transcript! Yey!

Last October 29, I took the exam 70-547: http://www.microsoft.com/learning/en/us/exams/70-547.mspx and I got a passing score (phew!) Well that was really really hard!

 

My strategy for this exam is based on the preparation guide of the exam it self, so quoting Microsoft Learning:

Candidates should have worked in the following phases of the application life cycle:

  • Technical envisioning and planning
  • Design and development
  • Stabilizing and releasing

If you are taking this soon, I would suggest that you focus on these topics:

  • Exception handling
  • SQL and Data Topics
  • Authorization and Impersonation
  • The usual master page and theme questions
  • Validator controls
  • Testing and Deployment

 

Thanks also to my Boss 😛 for getting us this wonderful reference books from Microsoft Press! This book is still available at amazon.com.