IThastobecool.com Geeks have opinions too!

6Jan/090

Identifying which MS Virtualization Platform your guest is running on

Today I was messing around with MDT (duh) and came to realize that when deploying to a MS virtualization platform I was gonna be in trouble when using the default make and model method that is build in MDT. (It all echoes Microsoft Corporation and Virtual Machine... so which VM Additions should I install?)
I found out that the BIOS date of the guests that are running on HyperV is different from guests that run on VPC or VS. But how to differentiate between Virtual Server and Virtual PC?! Hmm that was a though one.... After a evening of tweaking and messing around I found out that on a VPC guest there's a PnPEntity called "Sound Blaster 16", where a VS guest does not have this entity. There we go!

Therefore i wrote the following script, which will set the sPlatform variable to the according virtualization platform (VPC/VS/HyperV) and echo it back to the user. This of course is only to show it works. From a deployment point of view I would use this to install the right VM Additions on the guest.

[/vb]
'#***********************************************************************
'#* File:				Detect MS Virtual Platform.vbs
'#* Creation Date:		01*04*2009
'#* Author: 			Henk Hofs (Login Consultants)
'#* Purpose:			Detect on what Virtualization product guest is running.
'#* Usage:				This script will set the variable: sPlatform to HyperV, VPC or VS.
'#* 					It will also print the value of sPlatform to the console.
'#*
'#* Revisions:			0.1   HHO 	Initial Version
'#***********************************************************************
Dim sPlatform
Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
Set colItemsMSVI = objWMIService.ExecQuery("SELECT * FROM Win32_Bios")
For Each objItem In colItemsMSVI
Select Case objItem.Name
Case "BIOS Date: 05/05/08 20:35:56  Ver: 08.00.02"
sPlatform = "HyperV"
Case "BIOS Date: 02/22/06 20:54:49  Ver: 08.00.02"
LDT_VPC()
If sPlatform = "" then
sPlatform = "VS"
End If
Case Else
MsgBox "Not VPC, VS or HyperV"
End Select
Next
Wscript.Echo sPlatform
Function LDT_VPC
Set colItemsVPC = objWMIService.ExecQuery("SELECT * FROM Win32_PnPEntity WHERE name=""Sound Blaster 16""")
For Each objItem In colItemsVPC
If objItem.Name <> "" then
sPlatform = "VPC"
End If
Next
End Function
1
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

*

No trackbacks yet.