Ok so in this article we are going to create our first workflow that executes a powershell script that adds a computer account to active directory in whatever OU you would like it to be placed in. Our Powershell script will get loaded in to the Model Manager Repository and we will modify the “MachineRequested” workflow stub to execute our script. Then we will use the workflow stub property to determine for which VM’s we want want the workflow stub to execute.
Dependencies
Active Directory Module for Powershell
- Open the Powershell Console
- Run “Import-Module ServerManager”
- Run “Add-WindowsFeature RSAT-AD-Powershell”
Installation
Create Powershell Script
First thing we need to do is create our powershell script. The script that we will need has to do a few things. It needs to pull values from vCAC that will be used to add the machine to AD. The values we are going to pull are Hostname, DNSDomain, & Active Directory OU. We will use the Hostname and DNSDomain to create the FQDN for the server. The code for the script is below or you can just download it from the download page.