Skip to content

Instantly share code, notes, and snippets.

Last active Sep 15, 2015
What would you like to do?
Determine if powershell runs within a virtual machine.
function isVM{
(gwmi win32_bios).version -match "vrtual"
or (from
Function isVM {
$objWMI = Get-WmiObject Win32_BaseBoard
$bln = ($objWMI.Manufacturer.Tolower() -match 'microsoft') -or ($objWMI.Manufacturer.Tolower() -match 'vmware')
return $bln}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment