Start and stop VMware Server 2 services automatically

I use the free VMware Server for a few test and dev purposes on my laptop, but I don’t have any VMs that run all the time. So of course it annoys me to have the VMware Server services running the rest of the time, just sitting around twiddling their thumbs. I’m absolutely certain it takes some of my system resources for them to shoot virtual spitballs at each other in their boredom.

At first I simply scripted the starting and stopping of those services so I could manage them easily when I wanted to. As is usually my way, what originated as two separate scripts (one of net start commands and one of net stop commands, run manually), eventually morphed into a thing with little bits of logic that controls everything from the start of my server use through to the end.

A mis-named couple points of interest:

  • When I added the browser launch statement after starting the services, I found I needed to delay a couple seconds to reliably get the login screen. I’ve only used this script on a couple laptop hosts so try it without this delay on your system, in case it’s something weird with mine.
  • The script will sit at the IE launch statement until you close the last instance of the browser. Since I only use IE for the VMware Infrastructure Web Access, and so it’s unlikely there are multiple instances, the logic in the script is simple and reliable. If you use IE for normal browsing you’ll likely need to come up with a cleverer way of telling the script to shove on and stop the services.
  • Once this all worked reliably I eventually wished to get rid of the annoying command window that stays open the whole time the script is active. I found, through the wisdom of the internet, the attached .js launch method to solve that.

Now I have a quick launch shortcut pointed at vmware2_launch.js to keep things simple and clean. This works well on the two systems I use, both running VMware Server 2.0.2:

  • Win7 Home Prem SP1 x64
  • WinXP Pro SP3 x86

Here are the code segments. (I need to find a simpler, less aggravating way to present cleaner code in WordPress posts.)

Edit: updated after installing SyntaxHighlighter Evolved. Very nice.

vmware2.bat

@echo off

REM **** Check if Tomcat is running. If so, assume all VMware server services are running. Otherwise,
REM ** start them.
tasklist /FI "IMAGENAME eq tomcat6.exe" 2>NUL | find /I /N "tomcat6.exe">NUL
if %ERRORLEVEL%  equ 0  ( 
	echo Tomcat is running, just get on with it.
	) else (  
		REM **** Start VMware services ****
		net start VMwareServerWebAccess
		net start vmauthdservice
		net start VMwareHostd
		net start vmnetdhcp
		net start "vmware nat service"
		
		REM echo Let's wait a couple--ok alot--of jiffys to let Tomcat get ready

		REM x is Number of miliseconds to delay
		> "%Temp%.\sleep.vbs" ECHO WScript.Sleep 2 * 1000
		CSCRIPT //NoLogo "%Temp%.\sleep.vbs"
		DEL "%Temp%.\sleep.vbs"  )

REM **** Start web browser ****
REM **Using the <hostname> instead of "127.0.0.1" or "localhost"
REM **avoids the annoying certificte warnings

"C:\Program Files (x86)\Internet Explorer\iexplore.exe" http://zaphod:8308/ui/#


REM ** Stop VMware services **
net stop VMwareHostd
net stop vmauthdservice
net stop vmnetdhcp
net stop "vmware nat service"
net stop VMwareServerWebAccess

vmware2_launch.js

var WindowStyle_Hidden = 0
var objShell = WScript.CreateObject("WScript.Shell")
var result = objShell.Run("cmd.exe /c vmware2.bat", WindowStyle_Hidden)

13 mile run with T&M

This was a good run. We used the B&A again because it’s brainless; easy to plan, easy to execute. And it was fast! I’m sure this is the fastest long run I’ve managed. 9:37/mile! Yeehaa. I was feeling pressed the last two miles but it was completely manageable.

The fuelbelt is working well. I’m satisfied with the Hammer HEED and Perpetuem combo. It only has three bottles totalling 21 ounces though, so I think I’m a little behind the overall hydration curve. Have to work on that. Self-supported long runs will require some planning. I’m sure the marathon will have plenty of liquids on-course so no worries there.

The pictures were challenging, and fortunately comical, this time so I’m posting them all. (At least we enjoy it.)

Whoa. Let's try again without the acid.

Mackenzie going with the blinky look

Eyes wide open. And did my arm get longer?

16 mile solo run around Riva

Worst run ever. I’m new to marathon running. “Everyone has at least one bad run per event.” This was mine. I hope.

Might be because of the hills. Or the cold, wet, grey, anti-motivating weather. Or missing my running buddies.

Doesn’t matter. It was the hardest run I’ve ever done. And for that reason maybe the most fulfilling. I hope not to be this fulfilled again.

One interesting thing is I was able to find 16 miles in my local neighborhoods without too much out-and-back or re-looping. I think I used every road there is.

Nick and the Wii tennis cycle trainer

My very good friend Nick loves riding his bike but hasn’t had any time (family, kids, owns his own home improvement business) and a knee injury doesn’t help either. On top of that there are the universal hassles of getting out on the bike (gear, weather, darkness, motivation) we all know and hate. He wished he could ride more.

His wife Nikki got him a trainer in the hopes it would help him use his lovely Fuji-molded carbon-ness more. Unfortunately I kept forgetting to bring over an extra skewer that would fit the trainer. I finally remembered so, while there checking on the dogs while they were away, I swapped the skewer and put the bike on the trainer as a welcome home surprise.

I got a a text from Nick the night they got home, and while I won’t go into details, it involved bikes, and trainers, and miles, and dress shoes and I could tell he was happy.

Tonight I got an email from Nikki with this great picture attached. Of course Nick wouldn’t be satisfied with just riding his bike. Most of us need a distraction cycling indoors. Many of us choose tv or movies or videos of cycling workouts…some of us need more than that. Nick needs more hand-eye-coordination-challenging activities. Coming to a fitness center near you: Wii tennis cycle trainer tournaments.

You saw it here first.

Elkridge run with Larry

…or “My longest run ever”

This is officially the longest run I’ve ever done. (I promise not to keep saying that for every new long run I do from now until April 9th. That would get boring and repetitive and generally go against my practice of being exciting and original.) My longest run to date had been the half-marathon at the end of the Eagleman Ironman 70.3 triathlon. And for those of you paying attention, I walked almost half of that. So my longest sustained run to date was the 12 mile training run leading up to that tri. Yay me.

I met Larry at his house and we started from there. He only had 6.5 on the docket for the day, having done his long run yesterday, and had a good loop in mind. We chatted for the first loop and generally enjoyed catching up. Back at his house he peeled off and I did another loop. It was a little challenging with no sidewalks and road shoulders full of snow banks but the traffic was light and courteous.

It felt good. It’s the first long run I’ve done without my training buddies, my good friend Tim and his daughter Mackenzie, and I look forward to running with them again in two weeks. (I’m traveling for work next weekend so will have to really run on my own for the first time. 14 miles somewhere in Manhattan. Anyone know a good route in the park?)

Garmin data is here. (I was getting bogus heart rate data most of the run. I think that means there’s something wrong with my chest strap transmitter or the Garmin unit itself…hopefully not something wrong with my heart. I’m not that good an athlete.)

Another 12 miles with Team Williams

It was 26 degrees today (at the start anyway, it was probably less than that 2 hours later when we finished) but at least it was clear. We unanimously decided we prefer 26 and clear to 38 and rainy! And while some people would consider 26 balmy (a friend ran yesterday morning when the wind chill was 6 degrees) we pretty much had the trail to ourselves.

Conversation topics ranged from our preferred training conditions, bike trainers, and why Glen wore sunglasses, to business marketing ideas and the relative benefits of mid-trail modified Tai chi for an audience of goats.

It was a good run for me. I felt good even though it’s the first long run we’ve done under the 10min/mile average. Mackenzie was especially stalwart, having not run in 10 days and missing last week’s “recovery’ 10 miles.

Activity details here.

The post-run photo is becoming a fun “thing” so I’ll keep posting them, to liven-up my dry blog entries if nothing else.

image

12 more miles with Tim and MJ

One nice thing about training in the cold is the B&A Trail is a lot less crowded. This stands to reason: the sane people not only have no need to prove to anyone they can run/walk/skip/ride/amble in the cold, but they also know to simply avoid the crazy people who do.

Cold and clear and hard. This is my first ever run on the B&A. I’ve biked on it some, but it’s nice to be able to move slower and actually see what’s around you. On the bike I end up so busy concentrating on staying on Tim’s wheel and navigating around other trail users that I don’t get to see much of the scenery. I also never noticed just how long and steep the hill is that leads from the parking lot to the trail head. Pushing up that half-mile hill right out of the starting blocks, before I’m warmed up and comfortable, is…well, uncomfortable. (One of the reasons for my sub-mediocre endurance athleteness is that I don’t suffer well. Sure, spin me around in an airplane, turn me green in an Atlantic Ocean gale, or ask me to eat the same thing for lunch for a year and I’m fine. Actually with aplomb, as I’ve been told. But push me into the red-zone during a long training session and I’ll get quiet and really, really want to stop.)

Highlights included finding two lacrosse balls, separately (which kept me entertained for quite a while), the new sport of the “bamboo javelin toss” coming to a winter Olympics near you, and a very brief juggling exhibition consisting of lacrosse balls and a basketball. I eventually donated the lacrosse balls to the Williams family sports equipment inventory and no, I did not carry the basketball with me during the run…it was left where I found it.

Activity stats from my Garmin

To quote Mackenzie, “It looks like Glen gained ten pounds on the run.” It’s the camera adding weight, I swear.

image

12 miles with Tim and Mackenzie

This was a satisfying run to finish. Cold, rainy, grey weather made the motivation hard to find. (I found mine hiding behind a chain link fence; my motivation isn’t that bright.) Starting at City Dock, we went out to Greenbury Point and back. We were all surprised by the number of dog walkers and families we passed on the Greenbury loop. The cold rain and muddy track would have made me go elsewhere if I was just looking for a nice place for an afternoon walk.

I feel pretty good right now, except for my all of my legs, back, shoulders, torso, and head.

Stats and track here.

To celebrate the event, and provide some evidence of our hard-coreness, here’s the post-training mugshot.

image