The method below is one I have developed to migrate from a XenDesktop 4 Pre-assigned group with no VMWare integration to a XenDesktop 5.x Existing Machine Catalog.
The challenge was the export from XenDesktop 4 obviously did not include the hypervisor path to the VDIs. This is obtainable using PowerShell but if your Farm is large and has grown organically you will find that the export from XenDesktop 4 will not match the output from the PowerShell command.
To get the two exports to match up I will show you how to use an Access 2010 Query.
I don’t think a lot of people are using dedicated / assigned VDIs but if you are this method could save you a lot of time. This blog only covers migrating the VDIs and user assignments, you still need to update your XenDesktop VDA before performing this.
The goal of this exercise to end up with a formatted CSV file that looks like this. We can then import this into our XenDesktop 5.x Catalog.
XenDesktop 4 Export
Install Powershell SDK on your XenDesktop 4 Controller
Run the following command to get a list of all your XenDesktop VDIs
Get-XdVirtualDesktop | Export-Csv C:tempxendesktop4.csv
You should then end up with a .csv file that looks like this
Delete #TYPE Citrix.PS.Commands.XdVirtualDesktop from the top row and then copy the Name column into column A and give it a column header called MachineName. Select the column and do a search and replace. Replace CONTOSO with nothing. Do the same with $sign. Rename Column B header to ADComputerAccount and Column C header to AssignedUser
So you should now have 3 columns that look like this
Save the file and XenDesktop4.xlxs
VDI Hypervisor path
On your XenDesktop 5 controller load up PowerShell
Run this command to add the Citrix cmdlets
CD to the location that your VDIs are stored, in my examples the command is
If you don’t know the full path use DIR and then CD up to the next level, DIR again, and so on.
When you are in the location that your VDIs are, run this command
Dir | Select-Object name,fullpath | Export-Csv C:templondonVDIs.csv
This will give you an output of all the display names of VDIs and the Hypervisor path that should look like this
Delete the top row and rename the Column A to MachineName and Column B to VirtualMachinePath so that it looks like this
Save the file as LondonVDIs.xlxs
Now we will use Access 2010 to match up the records from the XenDesktop 4 Export with all those from the LondonVDI Export
Open up Access and create a blank database. Import the XenDesktop4.xlsx spreadsheet by using this method
1. Click the External Data tab and click the Excel button. Browse to the XenDesktop4.xlsx file, click Open, and then click OK.
2. Click open if you get a security warning.
3. Click next
4. Tick First Row Contains Column Headings and click Next.
4. Click Next and Next
6. On the last screen change Import to Table field to XenDesktop4 and click Finish and close.
Repeat these steps for the LondonVDIs.xlsx and make sure you name the Table LondonVDIs
You should now have the two tables you have imported on the left of your Access window like this
Click the Create tab and click Query Design. Select both the tables that you created in the previous step and click Add and Close
Drag the MachineName field from LondonVDIs Table to the MachineName field in XenDesktop4 Table
In the table at the bottom of the Query form click the arrow next to Field and select LondonVDIs.VirtualMachinePath.
In the next column do the same and select XenDesktop4.ADComputerAccount
In the third column select XenDesktop4.AssignedUsers
It should look like this
Now hit the big red Run button on the ribbon. The query should pick out the matching data from the two tables and display it like this.
We now have all the data we need, we just need to get it back into a format XenDesktop will like.
XenDesktop 5.x Import CSV
Copy the results data including the headers out of Access and into a Notepad text file.
Put square brackets around each of the column headers, remove any spaces between them, and put commas inbetween them.
Copy .vm including the white space. Paste this into a Find and Replace and replace with vm,
So far the file should be looking like this
Now copy $ including the white space.Paste this into a Find and Replace and replace with $,
The final file should look like this.
That’s it. Your file is now ready. Save it as .csv and import into your XenDesktop 5.x Catalog Using the Import List button