Guest script manager package

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.

Sign in to be able to add comments.

Comments 15


cdecanini_ 2 years ago
Fixed bugs:
- File on vRO server was not closed
- Single replace on bat file instead of multiple
PeterGiuliano 2 years ago
Hi - I have updated to vRO 7.3 in my lab environment (with new vcPlugin) and a lot of my existing uses of "Guest Script Manager" are now failing. Specifically if I run a script (it runs fine) reboot the guest os then run second script the second "Run Script in Guest OS" workflow fails with no exception thrown but an error in the vRO server.log.

Cannot connect factory (Reason: java.lang.IllegalArgumentException: interface ch.dunes.model.IVSOFactory is not visible from class loader) for wfExecution[ff8080815c1b5671015c1bc8d51c093b]

Any ideas
hutchxx 2 years ago
I use guest script manager to copy and execute scripts in linux red hat guests, recently linux admin replaced on a VM the VMtools with Open VM Tools, after that when i try to copy a file using GSM to the VM it reports as successful but it doesn't copy anything, any ideas?
cjanz 2 years ago
Not sure if anyone is monitoring this but I found a bug in workflow "Run Script in Guest" The failure condition for "Get Processes" sometimes does not evaluate properly and instead my whole workflow quits, rather than the desired action which is to check the error code and then re-insert the workflow into the wait loop.

Additionally, the re-insertion should point to the timeout decision, NOT to the Sleep / Count item.

Any ideas out there why it just up and quits after a failed "Get Processes", rather than evaluate the scripting element to parse the error?
RonPSSC 1 year ago
I'm basically in the same situation as the previous poster and hoping someone is monitoring to determine if, in fact, a bug exists in either the latest version of Guest Script Manager or the latest VMTools (Version 10 and above) installed on my Windows Servers machines (2012R2/2016).

To be very brief, when using the Guest Script Manager, attempts to install Software on a VM post-provisioning (i.e. Machine Activated Phase), the software installation fails. When I revert back to a previous version of VMTools (Version 9.4.15), the software installs successfully.

Just for info, I'm performing an unattended install of SQL Server 2012 via batch script called by a Resource Element. Just to be clear, the vRO 7 Workflow does execute properly. I'm also anticipating opening a Support Case with VMware but figured I'd post here first to see if anyone else has experienced similar issues.
RonPSSC 1 year ago
Hello;

I'm hoping this area is still being monitored?

I am having an issue where the Run Script in Guest fails when simultaneous operations are performed on a single machine (at approx the same time). Logs typically reveal 1 of the 2 following errors when run in succession on the same machine:

Error in (Workflow:Create temporary directory in guest / Scriptable task (item1)#8) The operation is not allowed in the current state.


Error in (Workflow:Copy file from guest to vCO / Scriptable task (item1)#9) (vim.fault.InvalidState) {
faultCause = null,
faultMessage = null
}


Is there any way to get this Script to run only once at a given time....regardless of which vRO Workflow may be calling the Guest Script Manager Package ? I understand this could delay processes somewhat but I'm thinking there may be some type of collision happening somewhere and having it execute successfully "all the time" is better than having inconsistent runs?

Running vRA/vRO 7.3 on vCenter/vSphere 6.5 at this time. I tried installing a few patches and even tested an upgrade to vRA v7.4 but still experienced the same condition when running simultaneous Guest Script Manager Operations.

Thx. Any help will be appreciated.

Ron
tbehnken 1 year ago
I am trying to find a way to automatically increase the version of the script resource when an edit is performed. Do anyone know of a way?

My team currently uses Guest script manager for all of our script management in VRO and while we each have our own personal repos, it would be nice to be able to revert a script version.
Mikael_8313 1 year ago
Good morning, everyone,

I just had a bit the same problem during the "Get-Process" stage I have the impression that it runs in loop and it doesn't work at home. Have you solved the problem? especially since for me I only need to execute a dnscmd command to delete an entry in a DNS server.

Best Regard

Mikael
fboulianne 1 year ago
The workflow run script in guest has an exception on item41 (make temp dir in vm) that's bound to the wrong exception message, it should be errorMessage instead of errorCode
RonPSSC 1 year ago
Hi Mikael_8313;

You can also try this methodology to run DNS Commands.

The 1st reference is for Adding DNS Records...https://marketplace.vmware.com/vsx/solutions/add-dns-record-blueprint-for-vrealize-automation-1-0?ref=company#resources.

The 2nd is for Deleting DNS entries.. https://marketplace.vmware.com/vsx/solutions/delete-dns-record-blueprint-for-vrealize-automation-1-0?ref=company#resources

In case the links above do not work, you need to be logged into VMware Solution Exchange. Once logged in, you can locate the above by looking for ADD and/or DELETE DNS RECORD BLUEPRINT FOR VREALIZE AUTOMATION. Now you don't really need to install the vRA Blueprint components just the vRO Packages. There are installation scripts for both. There will be a supporting vRO bundle for each DNS process....e.g. com.vmware.pscoe.build.cm.dnsadd.vro-1.0.0-10-bundle.zip.. Just install them and tweak them for your vRO/vRA Environment

IMO, Somewhat less complex and easier to trace than the Guest Script Wrappers... :)
lmar001 1 year ago
Hi everyone.
Is any possible way to get info from script result as variable? I see the output only in script execution log.
ectoplasm88 1 year ago
There are two outputs one with the text output from the script and one with an exit code.
vSuraj 11 months ago
Hey Guys, Can someone help me with this error.
Workflow execution stack:
***
item: 'Run script in VM guest/item25', state: 'failed', business state: 'null', exception: 'Exception binding empty'
workflow: 'Run script in VM guest' (24c23d4c-12be-4889-aa66-29b8a450f1cd)
| 'attribute': name=vcoPath type=string value=
| 'attribute': name=overwrite type=boolean value=true
| 'attribute': name=guestFilePath type=string value=
| 'attribute': name=result type=boolean value=false
| 'attribute': name=scriptType type=string value=batch
| 'attribute': name=guestOperationsReady type=boolean value=true
| 'attribute': name=errorCode type=string value=
| 'attribute': name=scriptFileName type=string value=
| 'attribute': name=scriptFileNameExtension type=string value=
| 'attribute': name=guestDirectoryPath type=string value=
| 'attribute': name=scriptFileNamePrefix type=string value=
| 'attribute': name=scriptOutputText type=string value=
| 'attribute': name=scriptExitCode type=number value=__NULL__
| 'attribute': name=scriptConfigurationProperties type=Properties value=#[#scriptContent#=#string#cd c:\Install\
mkdir Deployment
ccmsetup.exe /s#+#scriptTimeOut#=#number#60.0#+#scriptWorkingDirectory#=#string##+#scriptRefreshTime#=#number#60.0#+#deleteResourceAfterRun#=#boolean#true#+#scriptType#=#string#batch#+#resourceSearchReplace#=#boolean#false#+#scriptInteractiveSession#=#boolean#false#+#resourceToCopy#=#Any#Any#__NULL__#+#copyResource#=#boolean#false#]#
| 'attribute': name=scriptContent type=string value=cd c:\Install\
mkdir Deployment
ccmsetup.exe /s
| 'attribute': name=scriptTimeOut type=number value=60.0
| 'attribute': name=scriptInteractiveSession type=boolean value=false
| 'attribute': name=scriptWorkingDirectory type=string value=
| 'attribute': name=copyResource type=boolean value=false
| 'attribute': name=resourceToCopy type=ResourceElement value=__NULL__
| 'attribute': name=resourceSearchReplace type=boolean value=false
| 'attribute': name=successEventLog type=String value=The script was successful and outputted
| 'attribute': name=deleteResourceAfterRun type=boolean value=true
| 'attribute': name=scriptConfigurationResourcePlaceHolder type=ResourceElement value=dunes://service.dunes.ch/ResourceElement?id='b0004f79-cdbf-4890-a3fd-f86b438da9f1'&dunesName='ResourceElement'
| 'attribute': name=guestOsFamily type=string value=windowsGuest
| 'attribute': name=errorEventLog type=String value=The script failed and outputted
| 'attribute': name=scriptRefreshTime type=number value=60.0
| 'input': name=vm type=VC:VirtualMachine value=dunes://service.dunes.ch/CustomSDKObject?id='vxvc15.ict.umcg.nl%2Cid:vm-266'&dunesName='VC:VirtualMachine'
| 'input': name=vmUsername type=string value=**********
| 'input': name=vmPassword type=SecureString value=__NULL__
| 'input': name=scriptConfigurationResource type=ResourceElement value=dunes://service.dunes.ch/ResourceElement?id='3585f516-1d41-42c1-bca5-01b824335237'&dunesName='ResourceElement'
| 'input': name=scriptVariables type=Array/CompositeType(stringToReplace:string,replacingString:string):scriptVariables value=null
| 'output': name=scriptExitCodeOut type=number value=__NULL__
| 'output': name=scriptOutputTextOut type=string value=
*** End of execution stack.
qc4vmware 11 months ago
So far as I can tell management of this tool has been completely abandoned... I've fixed many bugs and added additional functionality but trying to push those changes upstream has not been acknowledged. All you'll need to do to fix that current error is edit the workflow and make sure all of the objects have their exception linked to some attribute. Its sad because this is an extremely useful package but its easy enough to modify... unfortunately we don't all benefit. I might create a branch on github and upload my mods and try my best to incorporate changes from others.
cmautn1 11 months ago
I would be interested in seeing your fixes and improvements qc4vmware. I have had lots of various issues with this package.
;