Tuesday, July 3, 2012


Disable DEP (data execution prevention) on Virtual Machine withWindows 2003 installed using vmrun command


vmrun -T ws -gu Administrator runProgramInGuest "C:\Users\Administrator\Documents\Virtual Machines\Windows Server 2003 Enterprise Edition (3)\Windows Server 2003 Enterprise Edition (3).vmx" -activeWindow C:\windows\system32\bootcfg.exe /raw "/noexecute=AlwaysOff" /ID 1
Automatic revert a vmware snapshot for all virtual machines with Vbscript




Dim objShell,msg


Set objShell = CreateObject("WScript.Shell")
Set objWshScriptExec = objShell.Exec("""C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe"" -T ws list")
Set objStdOut = objWshScriptExec.StdOut


count = 0


    Do Until objStdOut.AtEndOfStream
countN = 0
        count = count+1
        strLine = objStdOut.ReadLine


        If count>1 Then
        
Set objShellN = CreateObject("WScript.Shell")        
Set objWshScriptExecN = objShellN.Exec("""C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe"" -T ws listSnapshots " & """" & strLine & """")
Set objStdOutN = objWshScriptExecN.StdOut


Do Until objStdOutN.AtEndOfStream
countN = countN+1
        strLineN = objStdOutN.ReadLine


        If countN>1 Then
        Set objShellV = CreateObject("WScript.Shell")        
        objShellV.Run("""C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe"" -T ws revertToSnapshot " & """" & strLine & """" & " " & strLineN)
WScript.Sleep(15000)
End If
       
        Loop

Set objShellX = CreateObject("WScript.Shell")
objShellX.Run("""C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe"" start " & """" & strLine & """")
WScript.Sleep(15000)
        End If


    Loop


WScript.Quit
And if you have 32bit system simply change "Program Files (x86)" with "Program Files"