VMware Cloud Community
future2000
Enthusiast
Enthusiast
Jump to solution

Add vRA deployed system name as input to a vRO powershell plugin executed script

Hi,

I have vRA 7 calling various vRO workflows for post customization of my windows server guests. I now need to configure a few domain groups and GPO's. I have the powershell code to do this but need to understand how I can get vRA to call a vRO workflow which then executes the powershell code based on the vRA system name.

I basically need to provide the powershell script I execute with the powershell plugin on my PS host the vRA deployed system name.

How can I pass that hostname variable as input to the powershell script?

Cheers

Reply
0 Kudos
1 Solution

Accepted Solutions
future2000
Enthusiast
Enthusiast
Jump to solution

Fixed. Presentation doesn't do what I needed...

Just added a new scriptable task entity before the Invoke and External script. This was hooked up to the vCACVm In Parameter and the scriptArgs string attribute. New output of scriptArgs was passed to the Arguments string value in the Invoke and External script.

The only code required was in this new scripatable task.

scriptArguments = vCACVm.vmDNSName;

The script now has its

$serverName parameter loaded with the VM name! Yay!

View solution in original post

Reply
0 Kudos
3 Replies
future2000
Enthusiast
Enthusiast
Jump to solution

I think I kind of figured this out. I parameterized the powershell script so it was expecting the input parameter... then modified my existing 'machine provisioned' workflow (built using my vRA wrapper template), added the vCO 'Invoke an external powershell script' workflow.  I defined a new string input which is passed a string value of the vCACVm:VirtualMachine using presentation to pass only the name object to the arguments input parameter on the invoke a powershell script workflow. 

But it didn't work. Not quite sure what I did wrong but will look next week!

Reply
0 Kudos
future2000
Enthusiast
Enthusiast
Jump to solution

Microsoft.ActiveDirectory.Management.ADServerDownException: Unable to contact the server.


The script wouldn't execute.


Adding forwardable = true to my krb5.conf fixed this. The script now executes. But unfortunately it wasn't passed the required variable.

The script simply creates a domain group, which is later added to the local administrators group on the server via a GPO as restricted groups are used in the domain...

param ($ServerName)

$SecurityGroupName = "AdminGroup_$Servername"

New-ADGroup -Name $SecurityGroupName -Path DC=domain,DC=local -GroupScope Universal -Description "LocalAccess"

my vRO workflow has a serverName string value which is passed to the 'Invoke an External Powershell script' workflow's arguments in parameter.

I hoped that by using presentation page and defining default value of vCACVm.name for my serverName string would pass the serverName value to the script.

This was not the case as the script executed an simply created the group without the servername appended?

Reply
0 Kudos
future2000
Enthusiast
Enthusiast
Jump to solution

Fixed. Presentation doesn't do what I needed...

Just added a new scriptable task entity before the Invoke and External script. This was hooked up to the vCACVm In Parameter and the scriptArgs string attribute. New output of scriptArgs was passed to the Arguments string value in the Invoke and External script.

The only code required was in this new scripatable task.

scriptArguments = vCACVm.vmDNSName;

The script now has its

$serverName parameter loaded with the VM name! Yay!

Reply
0 Kudos