- 2016-11-01 - Please note that this package has been relocated to the VMware Sample Exchange due to the recent decommission of FlowGrab.com.
- 2015-03-24 - The package is now hosted on fowgrab to allow communities contributions
- Updated 2015-01-05 by Daniel Linsley:
- Does not break anymore with UAC but UAC may still prevent some scripts to run.
- Improved sleep for better handling of low script refresh
Running commands or scripts in VM guest is something that has been done with vCO for quite a while using different mechanisms. A popular way was to use the VIX plug-in for vCO. This plug-in is not needed anymore since the VIX functionality is part of the vCenter API since vCenter 5.0 and there are guest operations workflows to copy a script and run it into a VM guest OS since vCO 5.1
Using these library workflows requires to copy scripts from the vCO file system or include the scripts in your workflows. Getting the script output can be tricky and if part of the script include parameters that need to be replaced with your custom workflows inputs it requires a bit more coding.
The Guest Script Manager handle all of this for you so you do not have to reinvent the wheel. You can even create specific workflows to run existing scripts without having to do any vCO scripting !
Features
Script management : Add, edit, delete a script configuration. A script configuration contains:
- Script type (bash, batch, Powershell) : Each type involve a different way of starting the script and getting the output.
- Script content: The script itself. May contain parameters that will be replaced right before running the script.
- Timeout: The time after the script execution is
- Script interactivity: In case the script open a window that requires user interaction.
- Script working directory: Where the script will run. Where the optional file will be copied.
- File to copy: A file to be copied in addition to the script. For example a response file needed for the script.
The script configurations are stored as resource elements in the vCO database. This means :
- Updating a script does not require updating a workflow
- The scripts are in a much safer location compared to the file system
- If you run a vCO cluster, the scripts are available for every vCO nodes
- That you can export / import the script configurations in a package
The script configuration runner : "Run script in VM guest"
- Search replace specified strings in the additional file, copy it to the guest (optional).
- Search replace specified strings in the script, run it in the guest.
- Get output code and output result, display these (including special characters supported by ANSI thanks to the included cmdAnsi.exe), fails the workflow if script failed.
There is also a workflow to run multiple scripts one after the other and a workflow to upload your files as resource elements.
Links
- Guest script manager tutorial
- Batch scripts samples
- PowerShell scripts samples
- Guest script manager package (updated November 2, 2016 as the package moved from flowgrab to sample exchange)
Credits
- Reuben for the original guest Operations package.
- vCO Engineering to make available guest operations workflows in vCO 5.1
- Benoit for the included / modified "run script in guest" workflow
- Pierre Torris for creating cmdAnsi. Donateware on www.ptorris.com
- Burke / Henrik for testing early releases
- Daniel Linsley for providing enhancements to the original package
Known issues
You must turn off UAC on Windows (2015-01-05) Package updated by Daniel
Use the package with the date to get the latest. The other one was kept for people needing the original.
Disclaimer: These samples workflows are provided AS IS and are not considered production quality and are not officially supported. Use at your own risk. Feel free to modify and expand and share your contributions.