VMware Communities
admin
Immortal
Immortal

Automator Actions

I've been toying with Automator recently, and came up with some actions for Fusion. Currently, the actions include:

  • List running virtual machines

  • List virtual machines in the Virtual Machine Library

  • Perform power operation on a list of virtual machines

    • Power On

    • Shut Down (soft)

    • Power Off (hard)

    • Reboot (soft)

    • Reset (hard)

    • Suspend

    • Pause

    • Unpause

Suggestions for more actions are welcome.

-


I will update this top post if and when I make updates so you don't have to search through the thread.

Nothing too exciting yet, this is mostly stuff you can trivially do with vmrun (pause/unpause is perhaps particularly interesting, since Fusion doesn't currently have a UI for this). For example, one useful combination would be to list all running VMs and pause them, and a matching action to list all running VMs and unpause them - this might be handy if you want to quickly devote computing power to some task but don't want to suspend.

The current version is 0.2008.09.02. To use, unzip and put the resulting actions in /Users/$/Library/Automator/ or /Libarary/Automator/

0 Kudos
17 Replies
admin
Immortal
Immortal

  • List running virtual machines

  • List virtual machines in the Virtual Machine Library

  • Perform power operation on a list of virtual machines

    • Power On

    • Shut Down (soft)

    • Power Off (hard)

    • Reboot (soft)

    • Reset (hard)

    • Suspend

    • Pause

    • Unpause

0 Kudos
rcardona2k
Immortal
Immortal

I'm not much of an Automator/Applescript tinkerer but I grok the concepts. I ran through your actions and I like the intuitive Automator "pipelining" interface. You have a good start and I would want to dive right into starting up processes within Windows guest via vmrun. Smiley Happy

I'll keep watching this thread for developments.

0 Kudos
borisdusek
Expert
Expert

    • Pause

    • Unpause

Never seen these - what do they do? "non-persistent" suspend, i.e. just stop giving CPU time to the machine? Where are they in Fusion menubar?

0 Kudos
admin
Immortal
Immortal

They aren't in the Fusion UI at all, which is why I mentioned them as being of interest. Your guess is correct - pause stops running the virtual machine, but keeps it in memory. Note that attempting to use Fusion with a paused virtual machine may not do anything, you need to unpause it first.

0 Kudos
HobbitFootAussi
Enthusiast
Enthusiast

Could we have "list running processes in VM" or "Grab screenshot of VM". For example I run my VMs in Spaces and would love an Automator action that perhaps runs a script in a VM (Windows) and watches to see when its done, or takes a screenshot every so often and shows it to me as the screen is hidden in another space.

0 Kudos
wila
Immortal
Immortal

Thanks Eric, more toys to play with, very nice Smiley Happy

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos
mlabonte
Contributor
Contributor

pause stops running the virtual machine, but keeps it in memory.

This is the thing I have always needed but never realized I wanted. Thanks!

0 Kudos
TheAngryPenguin
Enthusiast
Enthusiast

This is way cool, but WTF is Koi Productions?!?

0 Kudos
admin
Immortal
Immortal

I figured it might be a good idea to have a domain a while back, and that was the best I could come up with in 5 minutes. As you can tell, I never got around to doing anything with it (maybe someday...), but since Apple requires developers to use a unique domain for preferences and I already had that one, I just used it.

0 Kudos
Piggy
Enthusiast
Enthusiast

Really need to get 'pause' and 'unpause' in the UI. Why on earth would the developers not include them? Is it because of the dumbing down for Mac users?

0 Kudos
tasmund
Contributor
Contributor

I haven't used Automator Actions before.

I've fooled around with this for ten minutes and haven't got it working, so I thought I'd ask for more detailed instructions.

(1) Where do I look for these commands? I suspect the VMware Fusion menu, under the Services menu item.

(2) I had no Automator directory in either ~/Library or root /Library. Is this normal?

(3) I made an Automator director under /Library and put the three actions there. (I assume they don't need to be under the directory "0" in the ZIP file.) I restarted Fusion and couldn't see any evidence of these actions anywhere. Do I need to restart Fusion, or take some other action to have these actions show up, after installing them?

(4) I then deleted the Automator directory I created, along with the 3 action files in it, started the Automator application and imported these Actions in the top they would install. I tried dragging a single action into a workflow and playing the workflow, but it failed: The action “List Virtual Machines in Library” encountered an error.

(5) It then started to look like a great big hassle to use this package, so I thought I'd go for the vmrun command instead. I looked for vmrun inside the VMware application and couldn't find it: find /Applications/VMware\ Fusion.app/ -name 'vmrun' -print Perhaps it's an optional package. Perhaps it's installed somewhere else in the filesystem (/usr/bin). Is this why the Automator actions are failing?

Okay, now I'm going to look for the vmrun docs to find out where it lives...

Some more specific instructions would be very helpful.

Even more helpful would be a Pause function inside Fusion 2.0.5 or 2.0.6. Smiley Happy

0 Kudos
admin
Immortal
Immortal

(1) Where do I look for these commands? I suspect the VMware Fusion menu, under the Services menu item.

No, that's not how Automator works. You string together Automator actions using the Automator application to create scripts.

(2) I had no Automator directory in either ~/Library or root /Library. Is this normal?

I think so.

(4) I then deleted the Automator directory I created, along with the 3 action files in it, started the Automator application and imported these Actions in the top they would install. I tried dragging a single action into a workflow and playing the workflow, but it failed: The action “List Virtual Machines in Library” encountered an error.

You're getting closer, and that should have not errored out - I just tried it and it works for me. A quick Google search turns up resources like http://automator.us/leopard/index.html , since it sounds like you're not familiar with Automator, you should probably read up on it.

(5) It then started to look like a great big hassle to use this package, so I thought I'd go for the vmrun command instead. I looked for vmrun inside the VMware application and couldn't find it: find /Applications/VMware\ Fusion.app/ -name 'vmrun' -print Perhaps it's an optional package. Perhaps it's installed somewhere else in the filesystem (/usr/bin). Is this why the Automator actions are failing?

vmrun is in /Library/Application\ Support/VMware\ Fusion/, it's not an optional package.

Message was edited by: etung to fix incorrect statements. It's late and it's been a long time since I've looked at this :smileysilly:

0 Kudos
matthewls
Enthusiast
Enthusiast

Just to prove my novice status with unix, I can't get vmrun to run from the command line. Even though I'm in the /Library/Application Support/Vmware fusion directory, when I type vmrun the message "command not found" appears. I can run vmrun from finder, and run ls etc. from the command prompt...what am I missing?

0 Kudos
admin
Immortal
Immortal

Welcome to the command line, it's a bit daunting at first but rewarding Smiley Happy Short answer: you want "./vmrun" (no quotes)

Long answer: "vmrun" tells the OS to look in all the places it knows about (listed in $PATH) for programs and run the first one called vmrun that it finds. For security reasons, the current directory is traditionally not one of the places it looks (otherwise it's much easier to accidentally run a program, perhaps with security implications). In order to run a program that's not in your $PATH, you need to specify a path to that program so the OS knows you really mean it. "." is the current directory, and "/" is the path separator, so "./vmrun" means "look in the current directory for a program called vmrun and run it". Alternately, you could use "/Library/Application\ Support/VMware\ Fusion/vmrun" and not have to change into that directory first.

0 Kudos
admin
Immortal
Immortal

Since a couple people have been asking about pause recently, here's some scripts that pause or unpause all running virtual machines that Fusion knows about, as well as how I made them.

  1. Unpack the automator scripts into /Library/Automator . Note: While you could also use /Users/$/Library/Automator (and which I would personally prefer, as I don't like to stick things in the systemwide library), I need to do this in order to avoid having my username hardcoded into the resulting script. If you're following along at home, the one in your home directory is fine.

  2. Open Automator, choose new Custom workflow.

  3. Drag "List Running Virtual Machines" from the left list of actions to the right list of commands - it should be the only command there.

  4. Drag "Virtual Machine Power Actions" from the left list of actions to the right list of commands - it should come after the "List Running Virtual Machines" step

  5. Change the power action to pause.

  6. Save as "Pause Running Virtual Machines", file format Application.

Now repeat, but with the power action set to unpause, call it "Unpause Running Virtual Machines".

Things to note: there must be at least one running virtual machine, or the script will error out. You probably need exactly version 0.2008.09.02 for this to work (I see it's coded into the resulting application). Should I make an update, I'll include these sample apps as well. There's no feedback in Fusion that a virtual machine is paused - menu items will still be enabled even though they won't work, and so on.

You can get fancier, like changing the input in order to only pause or unpause a specific virtual machine.

0 Kudos
matthewls
Enthusiast
Enthusiast

Thanks very much! Ah, unix. I'm not afraid of the command prompt, and even used to do some (very minor and simple) rexx programming in OS/2 and batch processing in DOS. But I have never learned about the unix command prompt beyond ls, ls -a, man, etc.. In DOS the current directory was always searched....

./ works!

0 Kudos
Aldupon
Contributor
Contributor

I tried it and the VM is pausing. But.....

Now VW Ware is consuming 90% of the processing power in telling that its "not responding".

What can be done about this?

0 Kudos