|
|
|||||||
Hi. I've been looking for a Kix script which will detect if the client is running in a virtual environment. So far I've only been able to find this http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=110606#Post110606 The post is 5 years old now and I was wondering if this is the best way to do it? I've found some examples at this web site http://talhatariq.wordpress.com/2006/05/14/detecting-virtualization-2/ which suggest some other ways of doing it. I could probably have a go at converting them to Kix but if someone has already done it I don't want to reinvent the wheel. I want to put this functionality into our main logon script so if it detects it is running in a virtual environment it does not install certain software. Thanks. |
||||||||
|
|
|||||||
to keep it short, you could always check for let's say,nic, chipset / something in the file structure etc. |
||||||||
|
|
|||||||
This works for me. Code: $wmiColl = GetObject("WinMgmts:root/cimv2").ExecQuery("Select * FROM Win32_BaseBoard ") For Each $wmiObj in $wmiColl If $wmiObj.Manufacturer = "Microsoft Corporation" ?$wmiObj.Manufacturer ? "Virtual machine" Else ?$wmiObj.Manufacturer ? "Not a virtual machine" EndIf Next Sleep 5 |
||||||||
|
|
|||||||
Mart That doesn't work for me when I run on my Vista system on ESX 3.5. When I run my HWInfo() UDF, it returns the following: Code: Server Information for VISTAADMIN ===================================== 0 - System Manufacturer: VMware, Inc. 1 - System Model: VMware Virtual Platform 2 - System Serial Number: VMware-56 4d e5 19 96 73 af 12-bd 3d 26 91 38 61 5b 74 3 - BIOS Info: PTLTD - 6040000 [6.00] Code: Win32_ComputerSystem / Manufacturer Win32_ComputerSystem / Model Win32_BIOS / SerialNumber Win32_BIOS / Version You can get the HWInfo UDF from my web site, or just make the needed WMIQuery call - like Code: WMIQuery('Model', 'Win32_ComputerSystem', $_Target, '', '', '') WMIQuery is available here or on my site. I've run this under ESX 2.x and 3.x with good reliability. Maybe someone can report the results under MS Virtual Server, or other VMWare platforms. Glenn |
||||||||
|
|
|||||||
Yeah, I know. I do not have any VMWare so couldn't test. The original poster also did not specify what VM app he is using so I tested on my own system that only has MS virtual PC 2007 and not VMWare. Maybe the origin al poster can tell us what VM app he is using. |
||||||||
|
|
|||||||
Actually checking a service would probably be the best method. There are now also a few types of virtual machines VMware and Microsoft are maybe the biggest but there are others. Here is a script I wrote to detect VMware a few years ago. I would probable change the code now days a bit, but you get the idea. Code: Dim $SO $SO=SetOption('Explicit','On') $SO=SetOption('NoVarsInStrings','On') $SO=SetOption('NoMacrosInStrings','On') Dim $VMRunning $VMRunning = WithinVMware() If $VMRunning = 1 'Logon is running under a VMware session.' ? Else 'Logon is NOT running under a VMware session.' ? EndIf Function WithinVMware() Dim $InWMware Dim $VMTools, $VMProcess, $Key $InWMware = 0 Select Case 1 = KeyExist('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\VMip.exe') $InWMware = 1 Case 1 = KeyExist('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\VMwareTray.exe') $InWMware = 1 Case 1 EndSelect $WithinVMware = $InWMware EndFunction |
||||||||
|
|
|||||||
Thanks for all the replies. We are running VMware, Microsoft Virtual Server and Microsoft Virtual PC 2007. If I combine the two ways for Microsoft and VMware posted here it should do the job. Thanks again. |
||||||||
|
|
|||||||
Great. When you do get it done and tested please post your completed code so that others can benefit from it as well. Thanks |
||||||||
|
|
|||||||
looking for service? doc, you looked for tray app. how is that a service? the board/system method is quite clever, imo. but indeed it isn't full proof as there are so many products. on the other hand, which check is? we all know kixtart needs to be updated to understand the windows versions and CPU versions as they change. and even my newest installation of SBS says, it's running on PIII when it's actually running on core 2 duo. so, imo, the easiest and most suitable way would be to detect the system manufacturer |
||||||||
|
|
|||||||
I said checking a service WOULD probably be best, not that I WAS checking it. |
||||||||
|
|
|||||||
true. |
||||||||
|
|
|||||||
I still don't get it. why are you looking for applications, when returning the nic-properties is suffient? |
||||||||
|
|
|||||||
what you mean with nic-properties? |