Saturday, March 30, 2013

Deleting XenDesktop 5.6 desktop catalog virtual desktops in vSphere 5.1 fails with error: “Failed to remove the virtual machine; domain\VDIName001$.; A specified parameter was not correct.”

Problem

You’ve recently upgraded your vSphere environment from 5.0 to 5.1 with the following component versions:

vCenter Server: 5.1.0 Build 947673

ESXi Server: 5.10 Build 838463

… but noticed that when you attempt to delete existing desktop catalog virtual desktops in Desktop Studio, you receive the following error:

Failed to remove the virtual machine; domain\VDIName001$.; A specified parameter was not correct.

image

The details of the error are as follows:

Exception:
    System.Reflection.TargetInvocationException Exception has been thrown by the target of an invocation.
       at Citrix.Console.Common.CallbackEventArguments.OperationCompleteSynchronizer`1.GetResults()
       at Citrix.Console.Common.CallbackEventArguments.OperationCompleteSynchronizer`1.WaitForResults()
       at Citrix.Console.Desktops.UI.Dialogs.DeleteDesktopsWizardViewModel.Commit()
   
   
Inner exception:
    System.Reflection.TargetInvocationException Exception has been thrown by the target of an invocation.
       at Citrix.Console.Common.CallbackEventArguments.OperationCompleteSynchronizer`1.GetResults()
       at Citrix.Console.PowerShellSdk.DesktopService.Scripts.DeleteMachinesScript.<ExecuteNext>d__1c.MoveNext()
       at Citrix.Console.PowerShellInteraction.PowerShellScript`1.<ExecuteNext>d__9.MoveNext()
       at Citrix.Console.InteractionCore.ScriptBase.<ExecuteImplementation>d__1.MoveNext()
       at Citrix.Console.InteractionCore.Scheduler.ExecuteNext(ScriptExecution execution)
   
    ScriptHistory : Delete Desktop
    This script calls DeleteVirtualMachinesScript and deletes Broker desktops.
    3/29/2013 11:49:15 AM
   
    Get-ConfigRegisteredServiceInstance -Version 1 -InterfaceType 'SDK' -MaxRecordCount 2147483647 -AdminAddress 'svrctxddc01.Domain.internal' | Test-ConfigServiceInstanceAvailability -MaxDelaySeconds 1 -ForceWaitForOneOfEachType -AdminAddress 'svrctxddc01.Domain.internal'
   
    Get-ConfigRegisteredServiceInstance -Version 1 -InterfaceType 'SDK' -MaxRecordCount 2147483647 -AdminAddress 'svrctxddc02.Domain.internal' | Test-ConfigServiceInstanceAvailability -MaxDelaySeconds 1 -ForceWaitForOneOfEachType -AdminAddress 'svrctxddc02.Domain.internal'
   
    Get-AcctServiceStatus -AdminAddress 'svrctxddc01.Domain.internal'
   
    Get-PvsVmServiceStatus -AdminAddress 'svrctxddc02.Domain.internal'
   
    Get-ConfigServiceStatus -AdminAddress 'svrctxddc01.Domain.internal'
   
    Get-ProvServiceStatus -AdminAddress 'svrctxddc02.Domain.internal'
   
    Get-BrokerServiceStatus -AdminAddress 'svrctxddc01.Domain.internal:80'
   
    Get-HypServiceStatus -AdminAddress 'svrctxddc01.Domain.internal'
   
    Get-LicServiceStatus -AdminAddress 'svrctxlic01.Domain.internal'
   
    Set-Variable -Name 'MCSVirtualMachineNames' -Value @('S-1-5-21-1384921881-3793137998-3288394186-42162','S-1-5-21-1384921881-3793137998-3288394186-42163','S-1-5-21-1384921881-3793137998-3288394186-42164','S-1-5-21-1384921881-3793137998-3288394186-42165','S-1-5-21-1384921881-3793137998-3288394186-42166')
   
    Get-ProvVM -MaxRecordCount 2147483647 -Filter {(ADAccountSid -in $MCSVirtualMachineNames)} -AdminAddress 'svrctxddc02.Domain.internal'
   
    Remove-Variable -Name 'MCSVirtualMachineNames'
   
    Remove-BrokerMachine -InputObject @(3,7,6,5,4) -Force -DesktopGroup 1 -AdminAddress 'svrctxddc01.Domain.internal:80'
   
    Remove-BrokerMachine -InputObject @(3,7,6,5,4) -Force -AdminAddress 'svrctxddc01.Domain.internal:80'
   
    Unlock-ProvVM -ProvisioningSchemeUid 7d32a020-cefc-4cb3-a8e0-e87494212edd -VMID @('42117274-c8a2-65b7-a2e3-f9b07aa57c2b','421174f9-3065-a6c1-4a81-dd8854220b42','4211a8ed-1cc3-5f95-a1ab-e0f3ef00bba4','42114b74-f25d-5fcd-d950-79b83b4a9fd1','42112e90-0508-44b6-973d-a0d3e011254d') -AdminAddress 'svrctxddc02.Domain.internal'
   
    Remove-ProvVM -ProvisioningSchemeUid 7d32a020-cefc-4cb3-a8e0-e87494212edd -VMName @('CTX-VDI001','CTX-VDI002','CTX-VDI003','CTX-VDI004','CTX-VDI005') -RunAsynchronously -AdminAddress 'svrctxddc02.Domain.internal'
   
    Add-ProvTaskMetadata -TaskId 3e16ca94-6348-45e5-89b9-8d187ba646ed -Property 'Citrix_DesktopStudio_TaskGroupId' -Value 'fb546f2e-7382-4809-a834-21408545d625' -AdminAddress 'svrctxddc02.Domain.internal'
   
   
   
Inner exception:
    System.Reflection.TargetInvocationException Exception has been thrown by the target of an invocation.
       at Citrix.Console.Common.CallbackEventArguments.OperationCompleteSynchronizer`1.GetResults()
       at Citrix.Console.PowerShellSdk.Shared.Scripts.DeleteVirtualMachinesScript.<ExecuteNext>d__1e.MoveNext()
       at Citrix.Console.PowerShellInteraction.PowerShellScript`1.<ExecuteNext>d__9.MoveNext()
       at Citrix.Console.InteractionCore.ScriptBase.<ExecuteImplementation>d__1.MoveNext()
       at Citrix.Console.InteractionCore.Scheduler.ExecuteNext(ScriptExecution execution)
   
    ScriptHistory : Delete Desktop
    This script calls DeleteVirtualMachinesScript and deletes Broker desktops.
   1/1/0001 12:00:00 AM
   
    Get-ConfigRegisteredServiceInstance -Version 1 -InterfaceType 'SDK' -MaxRecordCount 2147483647 -AdminAddress 'svrctxddc01.Domain.internal' | Test-ConfigServiceInstanceAvailability -MaxDelaySeconds 1 -ForceWaitForOneOfEachType -AdminAddress 'svrctxddc01.Domain.internal'
   
    Get-ConfigRegisteredServiceInstance -Version 1 -InterfaceType 'SDK' -MaxRecordCount 2147483647 -AdminAddress 'svrctxddc02.Domain.internal' | Test-ConfigServiceInstanceAvailability -MaxDelaySeconds 1 -ForceWaitForOneOfEachType -AdminAddress 'svrctxddc02.Domain.internal'
   
    Get-AcctServiceStatus -AdminAddress 'svrctxddc01.Domain.internal'
   
    Get-PvsVmServiceStatus -AdminAddress 'svrctxddc02.Domain.internal'
   
    Get-ConfigServiceStatus -AdminAddress 'svrctxddc01.Domain.internal'
   
    Get-ProvServiceStatus -AdminAddress 'svrctxddc02.Domain.internal'
   
    Get-BrokerServiceStatus -AdminAddress 'svrctxddc01.Domain.internal:80'
   
    Get-HypServiceStatus -AdminAddress 'svrctxddc01.Domain.internal'
   
    Get-LicServiceStatus -AdminAddress 'svrctxlic01.Domain.internal'
   
    Set-Variable -Name 'MCSVirtualMachineNames' -Value @('S-1-5-21-1384921881-3793137998-3288394186-42162','S-1-5-21-1384921881-3793137998-3288394186-42163','S-1-5-21-1384921881-3793137998-3288394186-42164','S-1-5-21-1384921881-3793137998-3288394186-42165','S-1-5-21-1384921881-3793137998-3288394186-42166')
   
    Get-ProvVM -MaxRecordCount 2147483647 -Filter {(ADAccountSid -in $MCSVirtualMachineNames)} -AdminAddress 'svrctxddc02.Domain.internal'
   
    Remove-Variable -Name 'MCSVirtualMachineNames'
   
    Remove-BrokerMachine -InputObject @(3,7,6,5,4) -Force -DesktopGroup 1 -AdminAddress 'svrctxddc01.Domain.internal:80'
   
    Remove-BrokerMachine -InputObject @(3,7,6,5,4) -Force -AdminAddress 'svrctxddc01.Domain.internal:80'
   
    Unlock-ProvVM -ProvisioningSchemeUid 7d32a020-cefc-4cb3-a8e0-e87494212edd -VMID @('42117274-c8a2-65b7-a2e3-f9b07aa57c2b','421174f9-3065-a6c1-4a81-dd8854220b42','4211a8ed-1cc3-5f95-a1ab-e0f3ef00bba4','42114b74-f25d-5fcd-d950-79b83b4a9fd1','42112e90-0508-44b6-973d-a0d3e011254d') -AdminAddress 'svrctxddc02.Domain.internal'
   
    Remove-ProvVM -ProvisioningSchemeUid 7d32a020-cefc-4cb3-a8e0-e87494212edd -VMName @('CTX-VDI001','CTX-VDI002','CTX-VDI003','CTX-VDI004','CTX-VDI005') -RunAsynchronously -AdminAddress 'svrctxddc02.Domain.internal'
   
    Add-ProvTaskMetadata -TaskId 3e16ca94-6348-45e5-89b9-8d187ba646ed -Property 'Citrix_DesktopStudio_TaskGroupId' -Value 'fb546f2e-7382-4809-a834-21408545d625' -AdminAddress 'svrctxddc02.Domain.internal'
   

   
Inner exception:
    Citrix.Console.Models.CallbackEventArguments.ScriptException Failed to remove the virtual machine; Domain\CTX-VDI001$.; A specified parameter was not correct.
   
    Failed to remove the virtual machine; Domain\CTX-VDI002$.; A specified parameter was not correct.
   
    Failed to remove the virtual machine; Domain\CTX-VDI003$.; A specified parameter was not correct.
   
    Failed to remove the virtual machine; Domain\CTX-VDI004$.; A specified parameter was not correct.
   
    Failed to remove the virtual machine; Domain\CTX-VDI005$.; A specified parameter was not correct.

image

Reviewing the Recent Tasks in vCenter shows the following errors:

A specified parameter was not correct.

image

You notice that while the virtual desktops are deleted from with Desktop Studio, the virtual machines are not deleted in vCenter and their respective Active Directory accounts are not removed.

Solution

Citrix has released a patch on March 18, 2013 to correct this problem but prior to patching the environment, I would recommend to manually delete the orphaned virtual machines in vCenter as well as their respective Active Directory accounts.  Once that’s done, proceed to download and install the patch found here:

Hotfixes Update 4 - For Citrix XenDesktop 5.6 Controller x64 - English
http://support.citrix.com/article/CTX136580

Note that I wanted to start fresh so I proceeded to delete the desktop catalog after I patched the environment but noticed that the base disk wasn’t deleted so I manually removed that as well.  This may not be consistent but definitely worthwhile to check.

3 comments:

burdweiser said...

Does this patch apply to 5.6 FP1 also? I'm getting conflicting info from support. I'm using MCS with PvD in a dedicated pool.

Anonymous said...

Great article, relates directly to my problem......but the hotfix didn't fix the issue.

XD 5.6 FR1, vSphere 5.1 Update 1

Any thoughts are welcome. There isn't much on the web around this issue.

Anonymous said...

Thanks! This solved the problem that I was facing.