PVS and AHV powershell wizard

By | August 31, 2016

Its fantastic that we have MCS for AHV fully supported in XenDeskop after Synergy this year however there is still a big desire to run PVS on AHV.

Well the good news is that it works great, the bad, no gui support, or power management.

After digging I figured out how to link the virtual machines in a PVS machine catalog to AHV using the MCS plugin for AHV!

The prerequisites this powershell script will automate creation of the Machine Catalog, Delivery Group, clone the virtual machine template , create the AD account, enter the info to the PVS collection, and link the virtual machine to AHV so power actions will work!

Download the script: HERE

I am sure there are many edits to come so please reach out to me on Twitter if you have any requests!

Right now you have to edit the script to populate the variables for your environment as well as the per run settings, future versions i’ll make it accept command line parameters etc.

Getting started with the script:

Download and install the Nutanix MCS plugin for XenDesktop 7.9

Configure the MCS plugin and connect to accropolis, similar to mine below:

xendesktop screenshot for ahv

Now from your controller get your hypervisor uid for your connection, note change your -adminaddress value to reflect your envrionment.

Get-BrokerHypervisorConnection -adminaddress xdcontrol01.lab.revord.net | select name, uid

get-ahv connection

Note your UID value you’ll need this later for the script.

Next you need to stroll over to your administrative workstation or PVS Server and prep it.

First we need to register powershell for provisioning servers, here is a guide if you need instructions.

Now install the Nutanix powershell bits, here is a guide if you need instructions.

Finally to finish the prep we need to install the XenDesktop 7.9 powershell commands as well.

Browse to your 7.9 install media, in my case I extracted the iso so for me the path was: XenApp_and_XenDesktop_7_9\x64\Citrix Desktop Delivery Controller

Inside this folder you’ll see several powershell msi’s

  • ADIdentity_PowerShellSnapIn_x64.msi
  • Analytics_PowerShellSnapIn_x64.msi
  • AppLibrary_PowerShellSnapIn_x64.msi
  • Broker_PowerShellSnapIn_x64.msi
  • ConfigurationLogging_PowerShellSnapIn_x64.msi
  • Configuration_PowerShellSnapIn_x64.msi
  • DelegatedAdmin_PowerShellSnapIn_x64.msi
  • EnvTest_PowerShellSnapIn_x64.msi
  • Host_PowerShellSnapIn_x64.msi
  • MachineCreation_PowerShellSnapIn_x64.msi
  • Monitor_PowerShellSnapIn_x64.msi
  • Storefront_PowerShellSnapIn_x64.msi
  • UserProfileManager_PowerShellSnapIn_x64.msi

Go ahead and install all of them, you might need them.

Now we’ve installed all the powershell snap-ins we will need we can prep the provisioning server infrastructure.

Now I am assuming you have already captured a vdisk and are ready to deploy.  Also if you haven’t create a virtual machine in Acropolis with PXE boot or BDM that will boot a vdisk and ready to be used as the master vm template for deployment.   If you need instructions on these let me know I can write up how I did that.

Create a collection for your new virtual machines and create a new target device:

  • Give the device a name and i always add _Template so we know its just a collection template.
  • enter a fake MAC address that wont conflict in your environment, any random value in the first 3 octets should be fine.
  • make sure to set the boot from vDisk and type production.
  • Add your vdisk to the template

device properties

Once your device is created right click and select to “set Device as Template”

device template

 ***This is very important since the script will use the collections device template for all settings for each target added to PVS.

Next we need to edit the base values for the script before running, all of these are commented in the script but i’ll include them here.

#######################################################################

# Values that need to be edited per run of the script.

#######################################################################

# value for the name of the collection within PVS to add the machines to, this also uses the template set in that collection or information.

$collection= “Test”

# value for the machine Collection name within XenDesktop STudio

$machineCatalogName=”test”

# value for the Delivery group name within XenDesktop Studio.

$desktopGroup=”test”

# Name of the resource that will be published, this is what the users will see within Storefront.

$publishName=”Test Desktop”

# Group or user that will have access to this resource. You can leave this and edit later.

$userGroup=”revord.lab\CTX-Users”

####################################################################

# Parameters which have to be edited according to environment

####################################################################

# PVS Variables

$pvsAddress=”PVS01.lab.revord.net”

$Domain=”lab”

$pvsDomain=”lab.revord.net”

$site_1= “Site”

# Needs parent/child formatting

#example: $OU=”CITRIX/XENDESKTOP/VIRTUAL DESKTOPS”

$OU=”CITRIX/XENDESKTOP/VIRTUAL DESKTOPS”

$ahv_template=”PVS_Master_Template”

# Nutanix hostname

$prismAddress=”prism.lab.revord.net”

# XD variables

$xenDesktopController=”XDControl01.lab.revord.net:80″

# get hypervisor uid for AHV (should automate this)

# Run Get-BrokerHypervisorConnection | select name, uid

# note if you haven’t connected to a controller yet add -adminaddress <ddc name> before the pipe.

# Get-BrokerHypervisorConnection -adminaddress xdcontrol01.lab.revord.net | select name, uid

$ahvUID=”2″

 Now you should have all the pieces in place to run the script.

Leave a Reply

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