If you ever need to know if your running on parallels

I needed to do something different between my macOS debug builds, Windows on Parallels builds and Windows (they all have different access to MS SQL Server)

Came up with this to know if I was on Parallels

Public Function IsParallels() as boolean
  Dim sh As New Shell
  
  sh.Execute("tasklist /FI ""IMAGENAME eq prl_cc.exe"" ")
  If InStr(sh.Result, "Image Name") > 0 Then
    Return True
  Else
    Return False
  End If
  
  
End Function
7 Likes

image

hmmm simulate running in a simulator ? … hmmmmmmm

Thanks for sharing. It’s the first time I see a solution to this question.

Or you could check that the file exists in the parallels folder so you don’t have to go via a shell.

Apparently there are several ways this can be checked

This just happens to be my “quick and dirty way” :stuck_out_tongue:

What does this show on Windows under Parallels?

wmic computersystem get manufacturer,model /format:list

Under VirtualBox I see this:

Manufacturer=innotek GmbH
Model=VirtualBox

Manufacturer=Parallels Software International Inc.
Model=Parallels Virtual Platform

1 Like

a windows 7 vm using parallels 17

Manufacturer=Parallels Software International Inc.
Model=Parallels Virtual Platform

a windows 10 vm using parallels 17

Manufacturer=Parallels Software International Inc.
Model=Parallels Virtual Platform

nifty
another way to know !

1 Like

So it seems that Model is just enough

wmic computersystem get model /format:list

And looking for “Parallels Virtual Platform” or “VirtualBox” let us recognize those 2 environments.

On VMware this is returned:

Model=VMware7,1

1 Like

So

wmic computersystem get model /format:list

And looking for the strings “Parallels", “VirtualBox”, and “VMware” let us recognize those 3 environments.

:grin:

1 Like