I’ve been thinking for a while about this. How can I zero-out all my vm’s with just one schedule. I don’t want to manually add a schedule every single time I roll out a VM, I want a central point for administering this.
Today I noticed the blog on using the VIX API. The VIX API can be used for all sorts of things, including copying files to all your VM’s or installing MSI on your VM’s. (Check the blog article for a complete list of supported operations for the VMRUN command.)
If you can install MSI’s then you can also run a simple vbs script:
vmrun -T virtualcenter01 -h https://virtualcenter01.yellow-bricks.local/sdk -u root -p yell0wbricks -gu user -gp userpw runProgramInGuest "[storage1] Windows/Windows.vmx" c:\windows\system32\sdelfrag.vbs
Unfortunately I wasn’t able to test it myself, but it should work just fine. If anyone is able to test it please let me know.
Thanks Carter!
Carter Shanklin says
runScriptInGuest requires two arguments, a script interpreter as well as the script. For running a VBS in Windows you can just use runProgramInGuest.
A. Mikkelsen says
Hi,
You might for future referance remember to remove your pwd from the script 😉
But thanks for the idear, I was looking for something lige that, and your post gave me just the input i needed.
A. Mikkelsen
Duncan Epping says
that’s not my password 🙂
Cody Bunch says
I’ve been doing quite a bit of work in VIX as well. Zeroing out is just one of the many, many cool things you can do http://professionalvmware.com/category/vix/
Xavier says
The tittle of your post says “all vms” but the command specifies only 1 vm (windows.vmx). Am I misunderstanding it?
Duncan says
yes it’s just an example of how to run a script inside a VM from the outside. You would still need to create a loop or just use the line an x amount of times.