Working on a solution for automating virtual desktop provisioning, I had to find a easy and fast way to add a user who will be able to access the desktop via RDP. I wanted this to be as simple as possible, so it could be easy for maintain and edit.
Here are the pre-requisites for creating the workflow:
- Installed an configured vRealize Orchestrator
- vCenter Server is added to the vRealize Orchestrator
- Virtual Machine (or Template) user with Administrator right
- You Virtual Machine (or Template) has installed VMware Tool and it is running on ESX/ESXi
Let’s get started
- Login to your vRO via vRO client
- Be sure you on the Run view. Create a separate folder where you will put your new Workflow. In my case this is a folder called VDI. Once the folder is created, right click on it and choose New workflow
- Type a Name for the new workflow. In my case it will ‘Add RDP User’
- After that, navigate to Schema, expand the Generic collection, choose Workflow element and drag-and-drop to the location shown on the screenshot. After that you will be asked to choose a workflow, where you need to type Run program in guest and click OK. After that click on the Setup
- Here you need to put some data, which will be static and you will not have to add it every time you run the workflow.
- vmUsername – a local or domain user name, which has administrator roles on the VM’s OS which you are going to modify
- vmPassword – the password of the user, which is used as vmUsername
- vm – this will be the only Input for this workflow for now.
- interactiveSession – No
- programPatch – C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe
- arguments – just select Value and keep it empty.
- workignDirectory – skip
- environment – skip
- Click Promote
- Now we need to add a new Input for RDP user name. Navigate to Input tab, then select the narrow and add new argument. After that you can rename it to RDPUser and also add a proper description like – New RDP User.
- Go back to Schema and add a new Scriptable task using again drag-and-drop. After that click pencil to edit it.
- Naviate to IN tab, to add new Input. Select RDPUser and click Select.
- Navigate to OUT tab, to add new Output. We need to create a brand new attribute, so click on Create paramenter/attribute in workflow. After that type a name compiledarg and click OK.
- Go to Scripting tab and add compiledarg = “-command C:\\temp\\vRO_AddRDPUser.ps1 -RDPUser ” + RDPUser
- Click OK to go back to the previous workflow. Now we need to edit the Run program in guest workflow to use our new argument as an input. Click on the pencil to edit it.
- Navigate to Visual Banding. First we need to remove the current binding between In Attribute argument and IN attribute as shown on the screenshotAfter that we need to build another binding between compeiledarg and arguemnt
- Last thing to do before testing is to create a local scrip on the VM or template which will be run from the workflow with the additional argument
12param($RDPUser)net localgroup "Remote Desktop Users" /add $RDPUser
- Let’s Run the workflow. As my goal was to set a minimum inputs when the workflow is being run, I was able to minimize just to VM name and RDP User Name.
This work flow could be added to your Cloning workflow, so right after clone and sysprep, the desired user will be added to the remote desktop group, so the user can login and use his/her desktop.
Hopefully this will be as useful for you as it was for me.
Latest posts by Nikolay Nikolov (see all)
- Build a vRealize Orchestrator 7 (vRO) Cluster - February 13, 2017
- VMware vCenter Server Appliance 6.5 – Install and Configure - November 16, 2016
- Nutanix Upgrade fails at 93% - August 18, 2016