Targeting Group Policy at Hyper-V VMs

Targeting Group Policy at Hyper-V VMs

Rate This
  • Comments 1

I make heavy use of group policy in my home environment.  It makes it very easy to push out defaults to all of my various computers and virtual machines.  However, there are times when I have a setting that I only want applied to virtual machines.  Luckily this is somewhat simple to do.  You need to open the Group Policy Management console and go to the WMI Filters section.

image

Here you will want to create as many filters as make sense for your environment (as you can see, I have filters that divide my systems into physical and virtual as well as desktop or server).

image

Once you have created a filter you will want to add the following WMI filter to target virtual machines:

SELECT * FROM Win32_ComputerSystem WHERE Model = "Virtual Machine"

Finally, associate this filter with the group policy that you want applied to virtual machines in your environment.

Some quick notes:

  • This will only target Hyper-V virtual machines.  If you are using a different virtualization platform you will need to find out what model string that platform returns.
  • To create a group policy that only targets physical computers, just change the ‘=’ to ‘!=’ in the WMI query

Cheers,
Ben

Leave a Comment
  • Please add 7 and 3 and type the answer here:
  • Post
  • Very interesting post, maybe you can share some of the group policies you deploy for your virtual machines?  Thank you

Page 1 of 1 (1 items)