#189234 - 2008-08-22 03:06 PM
Detect Virtual Machine
|
Verne
Fresh Scripter
Registered: 2006-02-13
Posts: 19
Loc: United Kingdom
|
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.
|
Top
|
|
|
|
#189276 - 2008-08-26 02:06 AM
Re: Detect Virtual Machine
[Re: Mart]
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11623
Loc: CA
|
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.
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
|
Top
|
|
|
|
#189331 - 2008-08-28 06:40 PM
Re: Detect Virtual Machine
[Re: NTDOC]
|
Verne
Fresh Scripter
Registered: 2006-02-13
Posts: 19
Loc: United Kingdom
|
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.
|
Top
|
|
|
|
#189375 - 2008-09-02 11:54 PM
Re: Detect Virtual Machine
[Re: Lonkero]
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11623
Loc: CA
|
I said checking a service WOULD probably be best, not that I WAS checking it.
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 507 anonymous users online.
|
|
|