locked
How can I test from inside my C++ program it if runs in an App-V environment or not? RRS feed

  • Question

  • Is there a Windows API call, a registry entry, or another way, that a running application can use to test if it runs in a virtual environment or a "real" environment?

    Thanks for your help,

    Magne

    Tuesday, August 23, 2016 10:51 AM

All replies

  • You could run the following Powershell cmdlet, which shows all running exe's in VE (with PID, user and which VE):
     (Get-AppvVirtualProcess).appvpackagedata


    Roy Essers

    Tuesday, August 23, 2016 11:12 PM
  • Thanks Roy, for answering.

    As far as I understand, the Powershell is a command-based application used for VE administration. Maybe not easy to use this approach from within a client application? (Is Powershell available on all Windows versions?)

    Is there an API that a C++ program can use to check at run-time if it is running in real or virtual mode? I have tried to use the presence of the registry key [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SoftGrid] as an indication that the machine is virtual, but after the latest Windows 10 update, this registry key is present even when running non-virtual.

    The test for SoftGrid is probably just non-sense, but it has indeed seemed to work up until now.

    I found another suggestion to check the value of the environment variable SESSIONNAME. Maybe that is the way to go? (Which values to check for?)

    • Edited by magmy Monday, August 29, 2016 10:57 AM Added more info
    Monday, August 29, 2016 10:09 AM
  • If you are looking for a path to see if AppV is available in the machine or not using a registry key as you specified above I think [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AppV].

    Posted AS IS with No Warranties. Mark as Answer if this answers your question, It will help other community members.

    Thursday, September 1, 2016 2:43 PM
  • Powershell is available on all Windows versions starting Windows 7 inbox.
    Tuesday, September 20, 2016 12:45 AM