HOWTO: Automate the creation of Citrix PVS boot devices (ISO/VMDK)

Recently, I was working for a customer to automate the deployment of a Citrix Provisioning Services environment (PVS). The customer didn’t want to use the PXE and TFTP method for booting the target devices to PVS. Instead, the customer chose to use the CD-ROM (ISO) boot method for their target devices.

Because I wanted to automate the complete environment, including the creation of the ISO files, I was having a challenge. Searching the internet didn’t give me any results. Therefore, I gave it a last try by searching the PVS program folder. What I found there was really interesting. I came across this file called NewBootDeviceManager.dll-Help.xml.

filenewbootdevicemanagerdllhelp

I opened this file in Notepad and found the following content.

contentnewbootdevicemanagerdllhelp

Now it got interesting. This might just be the thing I needed. But how to use it?

Reading a bit further in the NewBootDeviceManager.dll-Help.xml file, I found this is actually a proper PowerShell snap-in. Simply a registration of a DLL file, adding the snap-in in PowerShell, and Bob’s your uncle.

installutilbdmpowershellsdkdll

The NewBootDeviceManager.dll-Help.xml file also gives some examples for creating different boot devices, like ISO files and boot partitions (VMDK).

Step 1 – Start the PowerShell Console in Administrator mode

So, let’s put this into action by starting the PowerShell console in Administrator mode. This is required, because we are going to install the BdmPowerShellSdk.dll file.

Step 2 – Install the DLL

posh_installutilbdmpowershellsdkdll

Execute the following command:

c:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe "C:\Program Files\Citrix\Provisioning Services Console\BdmPowerShellSdk.dll"

Remember to change the path to installutil.exe for x86 environments.

Make sure the DLL is installed properly by looking for two lines that say “The Commit phase completed successfully.” and “The transacted install has completed.“.

posh_installutilbdmpowershellsdkdllsuccess

Step 3 – Add the snap-in

posh_addpssnapinbdmpssnapin

Execute the following command:

Add-PSSnapin -Name BdmPsSnapIn

Step 4 – Execute the (example) code

Execute the following commands:

$bdm = New-BootDeviceManager
 
$LoginServerList = New-Object 'System.Collections.Generic.List[System.Collections.Generic.KeyValuePair[string,string]]'
$ls = New-Object 'System.Collections.Generic.KeyValuePair[string,string]'("192.168.1.1", "6910")
$LoginServerList.Add($ls)
$ls = New-Object 'System.Collections.Generic.KeyValuePair[string,string]'("192.168.1.2", "6910")
$LoginServerList.Add($ls)
$bdm.LoginServers = $LoginServerList
 
$bdm.SetOptions($true, $false, $true, 5000, 30000, $false, 0)
 
$bdm.DeviceIpDHCP = $True
 
$bdm.DiskString = "Citrix ISO Image Recorder"
 
$bdm.ISOFileName = "C:\test.iso"
$bdm.Burn($false, $false)

This example adds two PVS login servers, uses DHCP and outputs this to an ISO file C:\test.iso.

filetestiso

For the full list of options and some examples, execute one of the following commands:

help New-BootDeviceManager
 
help New-BootDeviceManager -Full
 
help New-BootDeviceManager -Examples

Exception calling “Burn” with “2” argument(s): “ISOFileName must be called with the name of the new ISO file to create.”

errorbdm

If you come across the error Exception calling “Burn” with “2” argument(s): “ISOFileName must be called with the name of the new ISO file to create.”, this is a bug in the file BDMworker.dll. Citrix has a private hotfix that provides an updated version of BDMworker.dll that fixes this bug. Contact Citrix to receive the private hotfix.

Udate: This issue has been fixed definitively with the release of Citrix Provisioning Services 7.12. See their fixed issues list here.

Important note:

I have only tested the above steps with Citrix Provisioning Services version 7.8 and 7.9. I am not sure if it is also available or if it works in earlier versions.

Ivan de Mes

Ivan de Mes

Ivan de Mes works as an EUC Solution Architect for Login Consultants in The Netherlands. Ivan has over 19 years of experience in delivering workspace solutions at large customers in banking, health care, education and others.

The last 11 years his focus is mainly on translating business and IT requirements to workspace solutions, either cloud, VDI, or SBC. Moreover, he has a passion for IT and loves out-of-the-box thinking, troubleshooting, problem solving, and off course sharing findings and solutions on this blog!

In 2017 and 2018, Ivan was rewarded with the VMware vExpert status.



For more information, please read the about page.

You may also like...