Skip to content

Instantly share code, notes, and snippets.

@kayasax kayasax/isVM.ps1
Last active Sep 15, 2015

Embed
What would you like to do?
Determine if powershell runs within a virtual machine.
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
You can’t perform that action at this time.