Last active
September 15, 2015 08:31
-
-
Save kayasax/8ad1405cd0ba97becc31 to your computer and use it in GitHub Desktop.
Determine if powershell runs within a virtual machine.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isVM{ | |
(gwmi win32_bios).version -match "vrtual" | |
} | |
or (from http://www.windowsnetworking.com/kbase/WindowsTips/Windows7/AdminTips/VirtualPlatforms/UsingPowerShelltodeterminewhetherWindowsisrunninginavirtualmachine.html) | |
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