camilla

Convert autoit code into vb.net

7 posts in this topic

I found this code in the forum to Detect running in Virtual Machine I want to re-write it into vb.net if it is possible

this is the code :

------------------------------------------------------

Opt("MustDeclareVars", 1)
;Converted from VBS script found @ below address...
;http://blogs.technet.com/b/tonyso/archive/2010/05/13/how-to-tell-if-you-are-in-a-vm-using-script.aspx
;THAT1ANONYMOUSEDUDE Marlboroloco@gmail.com
 
If _VCheck() Then
MsgBox(0, "", "True")
Else
MsgBox(0, "", "False")
EndIf
 
Func _VCheck()
Local $strComputer = ".", $sMake, $sModel, $sBIOSVersion, $bIsVM, $sVMPlatform
Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
Local $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem")
If IsObj($colItems) Then
For $objItem In $colItems
;MsgBox(0,"","Name: " & $objItem.Name)
$sMake = $objItem.Manufacturer
$sModel = $objItem.Model
Next
EndIf
 
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", 0x10 + 0x20)
If IsObj($colItems) Then
For $objItem In $colItems
;MsgBox(0,"",$objItem.BIOSVersion(0))
$sBIOSVersion = $objItem.SMBIOSBIOSVersion
Next
EndIf
 
$bIsVM = False
$sVMPlatform = ""
 
MsgBox(0, "", "Manufacturer=" & $sMake)
MsgBox(0, "", "Model=" & $sModel)
MsgBox(0, "", "BIOSVersion=" & $sBIOSVersion)
If $sModel = "Virtual Machine" Then
; Microsoft virtualization technology detected, assign defaults
$sVMPlatform = "Hyper-V"
$bIsVM = True
; Try to determine more specific values
Switch $sBIOSVersion
Case "VRTUAL - 1000831"
$bIsVM = True
$sVMPlatform = "Hyper-V 2008 Beta or RC0"
Case "VRTUAL - 5000805", "BIOS Date: 05/05/08 20:35:56  Ver: 08.00.02"
$bIsVM = True
$sVMPlatform = "Hyper-V 2008 RTM"
Case "VRTUAL - 3000919"
$bIsVM = True
$sVMPlatform = "Hyper-V 2008 R2"
Case "A M I  - 2000622"
$bIsVM = True
$sVMPlatform = "VS2005R2SP1 or VPC2007"
Case "A M I  - 9000520"
$bIsVM = True
$sVMPlatform = "VS2005R2"
Case "A M I  - 9000816", "A M I  - 6000901"
$bIsVM = True
$sVMPlatform = "Windows Virtual PC"
Case "A M I  - 8000314"
$bIsVM = True
$sVMPlatform = "VS2005 or VPC2004"
EndSwitch
ElseIf $sModel = "VMware Virtual Platform" Then
; VMware detected
$sVMPlatform = "VMware"
$bIsVM = True
ElseIf $sModel = "VirtualBox" Then
; VirtualBox detected
$bIsVM = True
$sVMPlatform = "VirtualBox"
Else
; This computer does not appear to be a virtual machine.
EndIf
; Set the return value
If $bIsVM Then
MsgBox(0, "", "IsVirtualMachine=True")
MsgBox(0, "", "VirtualMachinePlatform=" & $sVMPlatform)
Else
MsgBox(0, "", "IsVirtualMachine=False")
EndIf
Return $bIsVM
EndFunc   ;==>_VCheck

-----------------------------------------------------------------------------------------------------

thank you in advance

Share this post


Link to post
Share on other sites



I need that someone help me to eat.

 

Just read a little bit about NET. then, write it yourself.


Saludos

1 person likes this

Share this post


Link to post
Share on other sites

I am trying to do what you propose,but I need that code now

Share this post


Link to post
Share on other sites

Pay for.


Saludos

1 person likes this

Share this post


Link to post
Share on other sites

haahahhahhhh

No I don't have money, if you want to help me okay if no please don't spam my  topic

Share this post


Link to post
Share on other sites

I am trying to do what you propose,but I need that code now

Ups sorry.

and yes, I'm an spammer.

Saludos

Share this post


Link to post
Share on other sites

upupupup

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now