Advertisement
lincruste

DetectVM

Apr 22nd, 2024
600
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Winbatch 0.54 KB | Source Code | 0 0
  1. @echo off
  2. net session >nul 2>&1 || (PowerShell start -verb runas '%~0' &exit /b)
  3.  
  4. chcp 65001 >NUL 2>&1
  5.  
  6. FOR /F "usebackq delims=" %%i in (`
  7. powershell -command "(Get-CimInstance -class Win32_computersystem).Manufacturer"
  8. `) DO SET _machinetype=%%i
  9.  
  10. IF %_machinetype% == "Virtual Machine" GOTO :VM ELSE
  11. IF %_machinetype% == "VMware, Inc." GOTO :VM ELSE
  12. IF %_machinetype% == "VirtualBox" GOTO :VM ELSE
  13. IF %_machinetype% == "Xen" GOTO :VM ELSE
  14. ECHO C'est une machine physique
  15. pause
  16. GOTO :EOF
  17. :VM
  18. ECHO C'est une machine virtuelle
  19. pause
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement