$Virtual = Get-wmiobject win32_computersystem | Where-Object model -EQ 'Virtual Machine' if ($Virtual){ Write-Host "`nSQL Server Running on Virtual Server" -ForegroundColor Green } else { Write-Host "`nSQL Server Running on Physical Server" -ForegroundColor Yellow }