VMware Cloud Community
JoJoGabor
Expert
Expert

Ways of passing property values to Powershell

I'm currently using the Guest Operations wrapper scripts for all my powershell interactions, and if I need to pass values to the Powershell script I use the search and replace options within these workflows to replace values in the script with property values. This works fine but feels clunky. Is there a more elegant way of doing this?

I like the Guest Operations Wrapper scripts as it allows me to track the progress of the script as well as error codes so want to keep using this method

Reply
0 Kudos
2 Replies
kericmiles
Enthusiast
Enthusiast

I'm assuming you are talking about this.

You can always use the Run Script in Guest workflow (not Run script in VM guest) and edit the script inside of a workflow then kick it off. I use that method on occasion when it makes sense (i.e. in a loop that needs the script to change on iteration). I feel the current implementation is going to be as elegant as you are going to get considering how vRO is structured.

Reply
0 Kudos
rszymczak
Hot Shot
Hot Shot

So, if I get you correct, you're using the VIX APIs to execue Powershell scripts within your VMs and instead of configuring the scripts in vRO using search & replace you want another solution?

What about building some PowerShell scripts that take input parameters and then using VIX to copy those scripts without any changes to the VMs and then starting them using VIX + passing the variables for the scripts?

This way you atleast get rid of that RegEx stuff. A single VIX script for starting a Powershell script on a VM that takes generic params would be enough for any script you can come up with.

Reply
0 Kudos