Skip to content

Instantly share code, notes, and snippets.

@neovov
Created April 12, 2013 13:50
Show Gist options
  • Save neovov/5372144 to your computer and use it in GitHub Desktop.
Save neovov/5372144 to your computer and use it in GitHub Desktop.
A list of shell commands to command a virtual machine (launching it, opening IE with a website, getting IE's PID, killing it and shut down the VM)
# Start the virtual machine
/Applications/VMware Fusion.app/Contents/Library $ ./vmrun -gu <username> -gp <password> start <VMX file> nogui
# -gu: Virtual's machine username
# -gp: Virtual's machine password
# <VMX file>: ~/Documents/Virtual Machines.localized/IE8.vmwarevm/Windows XP Professionnel.vmx
# nogui: Work headless
# Launch IE on the virtual machine and go to a given page
/Applications/VMware Fusion.app/Contents/Library $ ./vmrun -gu <username> -gp <password> runScriptInGuest <VMX file> -noWait -activeWindow "" "\"C:\Program Files\Internet Explorer\iexplore.exe\" http://google.fr/"
# -noWait: Return the prompt immediately
# -activeWindow: Show the window (should not be used in headless mode)
# "": Empty for using cmd.exe
# List processes
/Applications/VMware Fusion.app/Contents/Library $ ./vmrun -gu <username> -gp <password> listProcessesInGuest <VMX file>
# RegExp to find PID
# /pid=(\d+).+iexplore\.exe" http/
# Kill a process
/Applications/VMware Fusion.app/Contents/Library $ ./vmrun -gu <username> -gp <password> killProcessInGuest <VMX file> <PID>
# Suspend the virtual machine (can be replaced by "stop")
/Applications/VMware Fusion.app/Contents/Library $ ./vmrun suspend <VMX file>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment