Create new Citrix Provisioning target devices, including VMware VM’s, DHCP reservation and AD accounts from a CSV file with PowerShell

As you may know my motto is; Automate Everything. So when a costumer asked me to create almost 100 Citrix Provisioning Services Target Devices with a correlation between MAC and IP address I thought to myself;  let’s create a PowerShell script!’

The goal of the script:

  • Read data from a CSV file (see sample file) with the Hostname, IP Production network, MAC Production network, IP PVS Network, MAC PVS Network and Device collection.
  • Create new target devices in device collection in Citrix Provisioning Services
  • Create AD machine accounts
  • Create DHCP reservation in the PVS LAN
  • Replicate the DHCP reservation to second DHCP Server in PVS LAN
  • Create DHCP reservation in the Production LAN
  • Replicate the DHCP reservation to second DHCP Server in Production LAN
  • Create VM in VMware from Template Device
  • Set the MAC address of the new VM Production Network adapter
  • Set the MAC address of the new VM PVS Network adapter

The script is designed to work in an environment with VMware and where PVS and Production LAN are separated. If this is not the case you can of course edit the script to your liking! And if you have any problems editing the script you can always contact me.

Download Example CSV:


This is the first part of the script and must be ran on the PVS Server.

This is the second part of the script and must be ran on a server with VMware PowerCLI installed. Download PowerCLI here.

I hope this was informative. For questions or comments you can always give a reaction in the comment section or contact me:

Share

Leave a Reply

Your email address will not be published. Required fields are marked *