Skip to content

Instantly share code, notes, and snippets.

@behinddesign
Last active August 29, 2015 14:03
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save behinddesign/4c63f837bae8c515b6ec to your computer and use it in GitHub Desktop.
Save behinddesign/4c63f837bae8c515b6ec to your computer and use it in GitHub Desktop.
Autostart VMs - Make sure PfSense is running before launching anything else, then launch Plex and others if need be. Put files - C:\Windows\System32\GroupPolicy\Machine\Scripts\Startup and C:\Windows\System32\GroupPolicy\Machine\Scripts\Shutdown (replace start with stop or suspend)
@setlocal enableextensions enabledelayedexpansion
@echo off
set vmware_path="C:\Program Files (x86)\VMware\VMware Workstation"
set vms_path=C:\Users\MY_USERNAME_HERE\Documents\Virtual Machines
set ip_of_pfsense="PFSENSE_IP_HERE"
echo Starting VMS
echo ============
echo - PFSense
<nul set /p = "- Waiting to boot "
%vmware_path%\vmrun start "%vms_path%\pfsense\PfSense.vmx" nogui
:loop
set state=down
ping -n 1 %ip_of_pfsense% | find "TTL" > nul
if not errorlevel 1 set state=up
if %state%==down (
timeout 1 /nobreak > nul
<nul set /p =.
goto :loop
)
echo ... Booted
echo - Plex
%vmware_path%\vmrun start "%vms_path%\plex\Plex.vmx" nogui
endlocal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment