VMware Cloud Community
cloerner
Enthusiast
Enthusiast

Hand some Parameters to Powershell Script from vCO

Hi folks,

I wrote a simple workflow in vCO to execute a powershell script. This is working.

How can I hand over some parameters to the powershell script? I need to have a username as an input in the powershell script.

Thanks in advance

Chris

0 Kudos
1 Reply
igaydajiev
VMware Employee
VMware Employee

There a couple of ways

.

1. You can use "Generate an action from a PowerShell script" workflow.

This workflow generates vCO Action based on provided PS script.

When actions is generated from PS scripts you can use {#varname#} as placeholders which will be replaced before the scripts get's executed on PowerShell host.

The value can be provided from as action input parameter.

Check "samples\GenereateActionFromScript" folder for example of generated workflow and screenshot of how workflow was generated.

2. You can use "Invoke an external script" workflow to execute PS script that is already on PowerShell host machine.

Check "samples\InvokeExternalScript"  for example of script receiving  an argument and how it was invoked from vCO.

3. Invoke from scripting. Contains example how arbitrary powershell command can be invoked using vCO PowerShell scripting API.

Check "samples\Invoke from scripting".

note that for all examples I assume the hello.ps1 file is located in c:\temp folder.

0 Kudos