Fellow Australian and Microsoft Hyper-V Program Manager Ben Armstrong (a.k.a. Virtual PC Guy) has just published a blog explaining how you can deploy group policy object to be only targeting to virtual servers (see Targeting Group Policy at Hyper-V VMs).
To do this he explains that you can create a WMI query filter that means the Group Policy object will only apply to Hyper-V guests.
SELECT * FROM Win32_ComputerSystem WHERE Model = “Virtual Machine”
But what if you do not have Hyper-V guests deployed? Then you can running the following command on the virtual platform of choice to discover the model value to query.
wmic computersystems get model
In the example above you can see that this returns the vendor specific value of “VMWare Virtual Platform†(if you happen to be using VMWare). You can then take this model value to target the virtual platform of your choice (Hyper-V is of course the only valid choice).
SELECT * FROM Win32_ComputerSystem WHERE Model = “VMWare Virtual Platform”
TIP: You can also use the same method to target Group Policy object to specific hardware models of servers and workstations.
How to target Group Policy to Virtual Computers http://t.co/RXa488KirP
How to target Group Policy to Virtual Computers http://t.co/gOsKLNMuGG /cc @virtualpcguy
RT @alanburchill: How to target Group Policy to Virtual Computers http://t.co/RXa488KirP
RT @alanburchill: How to target Group Policy to Virtual Computers http://t.co/gOsKLNMuGG /cc @virtualpcguy
RT @alanburchill: How to target Group Policy to Virtual Computers http://t.co/gOsKLNMuGG /cc @virtualpcguy
The query for targeting VMware virtual machines should be SELECT * FROM Win32_ComputerSystem WHERE Model = “VMWare Virtual Platform” 🙂
Oh look… I even have that in the screenshot above it… Thanks
The screenshot also managed to get the WMIC command right but the text example above it has an extra ‘s’… computersystems 🙂
SELECT * FROM Win32_ComputerSystem WHERE Model LIKE “%Virtual%â€