All posts filed under: Hyper-V v2

Configuring anti-affinity for Hyper-V virtual machines

If you have worked on VMware, you might already be aware of a concept of DRS rules. Using DRS rules, we can create VM anti-affinity rules so that no two virtual machines hosting similar application roles run on the same ESX host. For example, when you have a virtualized SQL mirror or a virtualized SQL failover cluster, it is critical to separate the SQL virtual machines participating in the application group onto different ESX hosts. This is where we can use VMware DRS rules – “Separate Virtual Machines” rule to be specific.

Find all Hyper-V hosts and windows virtual machines in your AD environment

Several Microsoft products use Service Connection Points (SCP) to advertise themselves using objects stored in Active Directory. Clients query the directory to locate services. Microsoft Hyper-V, as I mentioned, also registers or publishes its information in AD as a service connection point. Now, we can use ADSI or AD cmdlets or Quest AD cmdlets to retrieve this information. To retrieve a list of all “Hyper-V hosts” in the AD environment, Using ADSI

Using Microsoft AD cmdlets

Using Quest AD cmdlets

The above methods retrieve the name of the computers running Hyper-V role. To retrieve a list of all “Windows Virtual Machines” in the AD environment, Using ADSI

Using Microsoft AD cmdlets

Using Quest AD cmdlets

This is it! If you observe the above code, I just changed the Name property alone to either “Microsoft Hyper-V” or “Windows Virtual Machine”. I tested the above commands only on Windows Server 2008 R2 and Windows Virtual machines only. I am not sure if Linux or other virtual machines running on Hyper-V get …

Auto generating VMConnect shortcuts for all Hyper-V virtual machines

I am sure this is one of the things written and read quite a bit. I just want to post my thoughts and how I try to simplify these things for me. I usually don’t write about anything that is not “my” content. As with all other things on this blog, I prefer automation and through this post I will provide a script that creates all the shortcuts for you automatically. If you don’t have the patience to read till the end of this post, click on the link below to access the script that generates these shortcuts. However, read the usage procedure for running the script towards the end of this post. What is this about? Coming to the subject of this post, I use Hyper-V at work and at home for various things. One thing I often need to do is access the console of these virtual machines. The usual (/boring) way to do that is to access Hyper-V Management console and then double-click on each virtual machine you need to access. The better way …

Refreshed home PC setup

With the recent release of Windows 7 & Windows server 2008 R2, I wanted to refresh how / what I need to install on my home PC. I received this PC with Windows Vista pre-installed and I was never a big fan of that OS. I have always been using Windows Hyper-V server 2008 and running various other operating systems as virtual machines on top of it. With the native VHD boot support on R2, I got a new usage model. Here is how it looks now  So, as it is shown in the diagram above, I am using Hyper-V Server 2008 R2 as the base OS. On top of it, I have Windows 7 and Windows Server 2008 R2 configured to boot using native VHD support. Note that they are not virtual machines. So, I will be able to see these two OS entries in the boot manager menu when I boot up the system. I will be able to use the complete physical machine capability when I boot these OS VHDs. I also …

Poor man’s P2V just got better; disk2VHD 1.1 is available

A week back I wrote about a new sysinternals tool called Disk2VHD. After the initial 1.0 release, many people have expressed the need for having command line support. Sysinternals team listened to all of this. They just released disk2vhd 1.1. You can now use the following options to perform p2v from command-line. Usage: disk2vhd <[drive: [drive:]…]|[*]> <vhdfile> Example: disk2vhd * c:\vhd\snapshot.vhd Where can you use this option? I can think of many possibilities. You can now use a simple script to walk through all of your systems in the data center and capture all physical hard drives as VHD files. Imagine being able to run this immediately after sysprep to capture the sysprep’ed system volume as VHD file. You can use that as a master image for both physical and virtual machines I will write about the second option sometime soon..Stay tuned.

Hyper-V: VHD Shell Extensions, updated release

I just posted a batch file wrapper around VHD Shell Extensions to find stale VHDs on a Hyper-V Server. However, because of VHDShellExt.vbs design, it will always try to find if the given VHD is associated with a VM on the local Hyper-V machine. One problem with this design is, you need to use the script on all the Hyper-V server machines you have to find any stale VHDs.  I have updated VHDShellExt.vbs to add /Server switch to be able to use it from a non Hyper-V system too. Now, using this new switch you can use the script from even a Windows Server 2003 or Windows XP system.  You can download the new release here Here is the updated documentation for this release

Hyper-V: finding stale VHDs

I use Hyper-V Server 2008 R2 for running many virtual machines for different purposes. For all of these virtual machines, I either create new VHDs and re-use the existing ones. Here is the problem. I don’t have SCVMM or any similar management software to maintain the VHD library. But I need to keep track of various VHDs because any accidental deletion might lead to unusable virtual machine infrastructure. VHD Shell Extensions script I created a few months back came to my rescue here. If you have not downloaded or started using this script yet, you can do some by visting this page on MSDN Code gallery. So, I just created a batch file wrapper around the VHDShellExt script. Here is what I have @echo off Set SCRIPTPATH=C:\Scripts Set VHDPATH=E:\VHDs :: Find all VHDs from the given VHD Path and use VHDShellExt.vbs for /f %%a IN (‘dir /b /s %VHDPATH%\*.vhd’) do “cscript %SCRIPTPATH% /action:detail /vhd:%%a”  %SCRIPTPATH% is the path to VHDShellExt.vbs and %VHDPATH% is the place where all your VHDs are stored. This script will validate all …