Virtualbox Headless-mode on Windows 7

An impromptu reformat of my Windows 7 machine quickly had me frustrated with Virtualbox reconfiguration. It had been so long since I had originally done it, and I had forgotten to document the nuances of that setup. So here goes:

Purpose

This specific VM configuration is FreeBSD 8.2 w/ ZFS on root. I don't have the time to set it up from scratch, but I'm currently using the newest ZFS version available on this site (v28, special edition).

I'm only planning on using this VM for SSH for a persistent irc connection. I also want this to start automatically at Win7's boot.

Install VM

So after installing FreeBSD and ports and of course, remembering to ENABLE SSH... I had to test the ssh connection.

(Remember to open the ports on the host side. I'm not going to walk you through that step.)

Headless VM

Now for the headless start.

I tried creating a .bat file that used VBoxHeadless. This let it start at boot, but it left an annoying cmd.exe window open.

Apparently a common issue. A common solution I used was to create a .vbs script to run the .bat file. This was both annoying and tedious but effective. Startup at boot and no lingering cmd.exe window.

Here are the contents of my .bat and .vbs files. I placed these in the same directory, and made a shortcut in the Start > All Programs > Startup to the .vbs file.

startfreebsdvm.bat

D:\"Program Files"OracleVirtualBoxVBoxHeadless.exe -s FreeBSD startvm-headless.vbs
Set WshShell = WScript.CreateObject("WScript.Shell")
obj = WshShell.Run("D:Users[username]startfreebsdvm.bat", 0)
set WshShell = Nothing