How to detect install is running on a VM?
-
Wednesday, May 13, 2009 2:22 PMAnyone have any ideas on how to detect if an installation is running on a virtual machine (regardless of VM vendor such as Microsoft, VMWare, Citrix, etc.)?
All Replies
-
Wednesday, May 13, 2009 10:34 PMModerator
I don't know, but if you figure it out, please post back the answer. You might get an answer if you post in the forums over at VMWare. It might be vendor-specific.
RobinDotNet
Click here to visit my ClickOnce blog! -
Tuesday, May 19, 2009 9:11 AMModerator
Hi ColbyRingeisen,
When an installation starts on a machine, the Windows Installer Windows service is started. The Windows Installer service will stop automatically shortly after the installation finishes.
So a possible solution is to retrieve the status of the Windows Installer service on the VM to detect whether an installation is running.
You can use the ServiceController.GetServices method to get all services available first and then get the Windows Installer service from the returned array. Use the ServiceController.Status property to get the status of the Windows Installer service.
Hope this helps.
Sincerely,
Linda Liu
Please remember to mark the replies as answers if they help and unmark them if they provide no help. end us any feedback you have about the help from MSFT at fbmsdn@microsoft.com. -
Tuesday, May 19, 2009 4:22 PM
Linda Liu,
I think you misunderstand what I'm trying to do. I'm not trying to detect if the installation is running, I'm trying to detect if it is being installed to a virtual machine as opposed to a physical machine (IOW, is the user installing my application to a VM or to a physical machine).
Basically, I need to dynamically disable the installation of some optional driver components included in my MSI package that should never be installed on a virtual machine. I know how to enable/disable the install of the components but I just don't know how to detect whether the target system is a VM or a physical machine. I also already have a C++ custom action DLL included in the package so I just need to know if there are any APIs that can be used to detect if the system is a VM or a physical machine. -
Tuesday, May 19, 2009 5:14 PMModerator
-
Tuesday, May 19, 2009 5:44 PM
Thanks to everyone who replied. Below is a summary list of the URLs I bookmarked:
Bookmarks
- codeproject Detect if your program is running inside a Virtual Machine. Free source code and programming help.url
- Detección de Virtual Servers hilpers.url
- How an application can detect if is running inside a Microsoft Virtual PC virtual machine virtualization.info.url
- How an application can detect if is running inside a VMware virtual machine virtualization.info.url
- How to detect install is running on a VM.url
- How to detect virtual machines softwares virtualization.info.url
- invisiblethings.org - Red Pill.url
- trapkit.de - ScoopyNG.url
- trapkit.de - VMM.url
- Virtual PC Guy's WebLog Detecting Microsoft virtual machines.url
- Virtualization – A Quick Tutorial « Whiteboard.url
- Marked As Answer by RobinDotNetMVP, Moderator Tuesday, May 19, 2009 7:06 PM
-
Monday, November 28, 2011 6:50 PMThere is a wiki topic for this at: http://social.technet.microsoft.com/wiki/contents/articles/942.aspx
tony soper


