Attempting to uninstall Citrix StoreFront from Windows Server 2012 server throws the error: “An error occured while trying to uninstall Citrix StoreFront”

Problem

You have Citrix StoreFront 2.1.0.17 installed on a server that does not belong to a server group which you would like to uninstall and reinstall so that you can join it to an existing server group.

clip_image002

You proceed to use Programs and Features to uninstall the Citrix StoreFront:

clip_image002[4]

.. but quickly notice that the following error message is thrown:

An error occured while trying to uninstall Citrix StoreFront

clip_image002[6]

Solution

Through a little bit of searching, I was able to find the following forum post outlining the instructions:

http://discussions.citrix.com/topic/304398-need-manual-uninstall-instructions/

I didn’t have to go through editing the XML files as shown in the instructions but I did run into a small error which threw me off for a bit until I carefully read the error message so I figure I’ll just outline the steps here in case someone encounters the same problem:

Begin by closing your Citrix administration consoles and launch PowerShell as an administrator:

clip_image002[8]

If you haven’t executed Citrix provided PowerShell scripts before, execute the following PowerShell cmdlet to allow them:

Set-ExecutionPolicy remotesigned

Proceed by changing the directory to c:program filesCitrixReceiver StorefrontScripts with:

cd “c:program filesCitrixReceiver StorefrontScripts”

Now if you proceed with executing the first cleanup PowerShell script:

ClearUp_1.ps1

… you will receive the following error:

PS C:Windowssystem32> cd “c:program filesCitrixReceiver StorefrontScripts”

PS C:program filesCitrixReceiver StorefrontScripts> .ClearUp_1.ps1

Removing feature instances

WARNING: There was a problem removing the features.

WARNING:

Remove-DSFeatureInstance :

At C:program filesCitrixReceiver StorefrontScriptsClearUp_1.ps1:51 char:1

+ Remove-DSFeatureInstance -All -Confirm:$false

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Remove-DSFeatureInstance], CannotGetExclusiveAccessException

    + FullyQualifiedErrorId : Citrix.DeliveryServices.Framework.Utilities.Exceptions.CannotGetExclusiveAccessException

   ,Citrix.DeliveryServices.Framework.Administration.Commands.Feature.RemoveDSFeatureInstance

PS C:program filesCitrixReceiver StorefrontScripts>

clip_image002[10]

What you have to do is load the Citrix PowerShell Snapin first by executing:

Add-PSSnapin Citrix.*

The ClearUp_1.ps1 should now execute and complete successfully:

PS C:program filesCitrixReceiver StorefrontScripts> .ClearUp_1.ps1

Removing feature instances

Feature instances removed

PS C:program filesCitrixReceiver StorefrontScripts>

clip_image002[12]

If you proceed an execute the second clean up PowerShell script ClearUp_2.ps1 in the same window, you will receive the following error:

PS C:program filesCitrixReceiver StorefrontScripts> .ClearUp_2.ps1

WARNING: This script should be run in a new PowerShell sessions with no Citrix DeliveryServices PS Snapins loaded.

WARNING: Exiting…

PS C:program filesCitrixReceiver StorefrontScripts>

clip_image002[16]

You will need to close and re-open PowerShell and this time DO NOT EXECUTE:

Add-PSSnapin Citrix.*

Simply change the directory to c:program filesCitrixReceiver StorefrontScripts with:

cd “c:program filesCitrixReceiver StorefrontScripts”

… then execute:

ClearUp_2.ps1

Answer Yes to the prompt to confirm the operation:

PS C:program filesCitrixReceiver StorefrontScripts> .ClearUp_2.ps1

Confirm

Are you sure you want to perform this action?

Performing operation “Uninstall-DSFeatureClass” on Target “30 feature classes”.

[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is “Y”): Y

PS C:program filesCitrixReceiver StorefrontScripts>

C:Program FilesCitrix

clip_image002[18]

The operation should complete within a few minutes:

clip_image002[20]

Proceed to uninstall StoreFront from the Programs and Features window:

clip_image002[22]

The process should complete successfully:

clip_image002[24]

clip_image002[26]

The last step is to navigate to:

C:Program FilesCitrix

.. then delete the Receiver StoreFront folder.