Step-By-Step: Uninstalling A Microsoft Lync Server 2013

Depending on the circumstances, it is sometimes necessary to uninstall Microsoft Lync Server 2013 a production environment. The example provided in this Step-By-Step showcases a Microsoft Lync Server 2013 environment that is composed of a front-end server and an Edge server. In the standard version, the CMS is hosted in a Microsoft SQL 2012 Express instance collocated with the Front End server. 
When you delete a deployment, you must publish a topology that contains only the CMS in order to continue to track the changes as the removal process unfolds. The topology document will contain only the most minimal in central management server references. It is necessary to use the Lync Server Deployment Wizard to remove the environment.
Complete the following steps in PowerShell or PowerShell ISE running in Administrator mode.
Step 1: Disable Lync users in the pool
Get-CsUser | Disable-CsUser

Step 2: Remove the configured conferences in the pool

Identity             : 1
ServiceId            :
TargetServerIfMoving :
Id                   : 1
Fingerprint          : c85d1be8-cafb-453e-8a12-590604bfdb31
Element              : <ConferenceDirectory Id="1"
                       Fingerprint="c85d1be8-cafb-453e-8a12-590604bfdb31" xmlns
                         <ServiceId xmlns="urn:schema:Microsoft.Rtc.Management.
                       Deploy.Topology.2008" SiteId="1"
                       RoleName="UserServices" Instance="1" />
                         <UpaSeparator xmlns="urn:schema:Microsoft.Rtc.Manageme
Retrieve the credentials directory numbers and delete conference with the following command:

Get-CsConferenceDirectory -Identity 1 | Remove-CsConferenceDirectory –force
Get-CsConferenceDirectory -Identity 1 | Remove-CsConferenceDirectory
Remove-CsConferenceDirectory : Conference directory with ID "1" is not empty.
If you delete this conference directory, you will affect users who use dial-in
conferencing. If you are sure that you want to delete it, use the Force
parameter with this command.
At line:1 char:41
+ Get-CsConferenceDirectory -Identity 1 | Remove-CsConferenceDirectory
+                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Remove-CsConferenceDirectory]
   , ConferenceDirectoryException
    + FullyQualifiedErrorId : Conference directory with ID "1" is not empty. If
    you delete this conference directory, you will affect users who use dial
  -in conferencing. If you are sure that you want to delete it, use the Forc
 e parameter with this command.,Microsoft.Rtc.Management.ConferenceDirector
You can also remove all conferences with the command:
Get-CsConferenceDirectory | Remove-CsConferenceDirectory -Force
Use the following command to verify that no conference is attached to the pool to be deleted:
Get-CsConferenceDirectory | where { $_.ServiceId.ToString().Contains("") }
Step 3: Remove authorized applications to communicate with the pool.
You can check for this configuration with the following command:
Clear any existing configurations:
Get-CsTrustedApplication | Remove-CsTrustedApplication –force
Step 4:
Remove the votes attached to the pool configurations
Removing object contacts for Exchange UM:
Get-CsExUmContact -Filter {RegistrarPool -eq ""} | Remove-CsExUmContact
Deleting object contacts for groups of responses:
Get-CsRgsWorkflow | Remove-CsRgsWorkflow
Removing objects contacts for conferencing application appointment:

Get-CsDialInConferencingAccessNumber | where {$_.Pool -eq ""} | Remove- CsDialInConferencingAccessNumber

Removing phones common areas and pool associated with analog phones:

Get-CsCommonAreaPhone -Filter {RegistrarPool –eq ""} | Remove-CsCommonAreaPhone 
Get-CsAnalogDevice -Filter {RegistrarPool –eq ""} | Remove-CsAnalogDevice

Deleting configurations associated call park:
Get-CsCallParkOrbit | Remove-CsCallParkOrbit  -Force
Step 5: Delete the voice components attached to the pool
Removal of routes:
Get-CsVoiceRoute | Remove-CsVoiceRoute
Removing bridges:

Open topology builder and delete all gateways:

Publish topology:
Step 6: Remove the EDGE server
In the topology builder, it is necessary to perform the steps of:

-          Remove association of the EDGE server pool to be deleted at the pool:


-  Disable Federation at the site:

-          Remove the EDGE server topology:

- Publish Topology

- Export Configuration from the Front-End server:

      - Import the configuration on the EDGE Server

    Import-CsConfiguration -LocalStore -Filename c:\
      Start the bootstrap on the EDGE server:
            %ProgramFiles%\Microsoft Lync Server 2013\Deployment\Bootstrapper.exe
      -To clean the server, remove all Lync components in the console "is adding Remove Programs" and the prerequisite software
Step 7: Remove the environment
At this stage of the process, it is necessary to utilize the assistant suppression topology builder.
Close the topology builder.

Open topology builder Download topology from existing deployment and publish the topology

Check the replication status with the commands:

Get-CsManagementStoreReplicationStatus -CentralManagementStoreStatus
PS C:\Users\cboucetta> Get-CsManagementStoreReplicationStatus
UpToDate           : False
ReplicaFqdn        :
LastStatusReport   : 6/6/2014 10:07:23 AM
LastUpdateCreation : 6/6/2014 10:07:20 AM
ProductVersion     : 5.0.8308.556
PS C:\Users\cboucetta> Get-CsManagementStoreReplicationStatus -CentralManagement
LastUpdatedOn                        : 6/6/2014 10:08:03 AM
ActiveMasterFqdn                     :
ActiveMasterLastHeartBeat            : 6/6/2014 10:08:18 AM
ActiveFileTransferAgentFqdn          :
ActiveFileTransferAgentLastHeartBeat : 6/6/2014 10:08:09 AM
ActiveReplicas                       : {}
DeletedReplicas                      : {}
Au terme de la réplication entre le serveur de gestion centralisée et le serveur Front-End, il est possible de supprimer définitivement le serveur de gestion centralisée.
Publish-CsTopology -FinalizeUninstall
PS C:\Users\cboucetta> Publish-CsTopology -FinalizeUninstall
Deleting server "" in pool "1-ApplicationServer-1".
One or more applications or external servers have been deleted.
When you delete an application or external server, you delete all configuration
 state information for the hosted applications. Do you want to continue?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help
(default is "Y"):Y
We can now
remove the rest of the environment with the bootstrapper:

C:\Program Files\Microsoft Lync Server 2013\Deployment\bootstrapper.exe /scorch
PS C:\Program Files\Microsoft Lync Server 2013\Deployment> .\Bootstrapper.exe /SCORCH
Logging status to: C:\Users\cboucetta\AppData\Local\Temp\Bootstrap-CsMachine-[2014_06_06][10_46_27].html
Checking prerequisites for bootstrapper...
Checking prerequisite WMIEnabled...prerequisite satisfied.
Checking prerequisite NoBootstrapperOnBranchOfficeAppliance...prerequisite satisfied.
Checking prerequisite SupportedOS...prerequisite satisfied.
Checking prerequisite NoOtherVersionInstalled...prerequisite satisfied.
Disabling unused roles...
Executing PowerShell command: Disable-CSComputer -Confirm:$false -Verbose -Scorch -Report "C:\Users\cboucetta\AppData\Local\Temp\Disable-CSComputer-[2014_06_06][10_46_32].html"
Removing AdminTools.msi(Feature_AdminTools)...success
Removing AppServer.msi(Feature_AppServer)...success
Removing MgmtServer.msi(Feature_FTA, Feature_Master, Feature_MGMTServer)...success
Removing Server.msi(RegistrarStoreUpdate, Feature_Server, Feature_Server_Update)...success
Removing WebComponents.msi(Feature_Web_AddressBook_Ext, Feature_Web_AddressBook_Int, Feature_Web_AdminUI_Int, Feature_Web_Autodiscover_Ext, Feature_Web_Autodiscover_Int, Feature_Web_CertProv_Ext, Feature_Web_CertProv_Int, Feature_Web_DataCollab_Ext, Feature_Web_DataCollab_Int, Feature_Web_DataMCUWeb_Ext, Feature_Web_DataMCUWeb_Int, Feature_Web_DevUpdate_Ext, Feature_Web_DevUpdate_Int, Feature_Web_Dialin_Ext, Feature_Web_Dialin_Int, Feature_Web_GroupExpansion_Ext, Feature_Web_GroupExpansion_Int, Feature_Web_HybridConfig_Ext, Feature_Web_HybridConfig_Int,Feature_Web_JoinLauncher_Ext, Feature_Web_JoinLauncher_Int, Feature_Web_LocationInfo_Int, Feature_Web_Lwa_Ext, Feature_Web_Lwa_Int, Feature_Web_Mcx_Ext, Feature_Web_Mcx_Int, Feature_Web_PassiveAuth_Ext, Feature_Web_PassiveAuth_Int, Feature_Web_PersistentChat_Int, Feature_Web_PersistentChatRM_Ext, Feature_Web_PersistentChatRM_Int, Feature_Web_Powershell_Int, Feature_Web_Reach_Ext, Feature_Web_Reach_Int, Feature_Web_Rgs_Ext, Feature_Web_Rgs_Int, Feature_Web_RgsConfig_Int, Feature_Web_StoreWeb_Ext, Feature_Web_StoreWeb_Int, Feature_Web_Ucwa_Ext, Feature_Web_Ucwa_Int, Feature_Web_WebScheduler_Ext, Feature_Web_WebScheduler_Int, Feature_Web_WebTicket_Ext, Feature_Web_WebTicket_Int)...
Step 8: Remove the database

When you delete the Microsoft Lync Server 2013 environment, you must also delete the files database and logs. In the present example, the environment is like Standard, the Central Management Store is collocated with the Front End server.

Removing Lync data bases associated with the pool:

Uninstall-CsDatabase -DatabaseType Application –SqlServerFqdn sv01lyncfe01. –SqlInstanceName rtc
Removing the CMS :
Uninstall-CsDatabase -CentralManagementDatabase –SqlServerFqdn sv01lyncfe01. -SqlInstanceName rtc
You can now delete the SCP Central Management Store present in the active directory with the command:
At this stage of the process, you can now remove the front-end all the necessary prerequisite for the deployment of Lync and SQL components.
Step 9: Reverse Domain Preparation

During the installation phase of Microsoft Lync Server 2013, a domain preparation was necessary, the following command removes the operations performed in the Active Directory:


PS C:\Users\cboucetta> Disable-CsAdDomain

Disable Domain
Removes Active Directory access control entries (ACEs) required to host Lync Server services in a domain. Any Lync Server services still in the topology might not function properly. Are you sure you want to proceed?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help
(default is "Y"):
Step 10: Invert the preparation of the forest

During the installation phase of Microsoft Lync Server 2013, a preparation of the forest was necessary, the following command removes the operations performed in the Active Directory:

Comments (3)

  1. chad says:

    Many Thanks – Stood this up in a TEST environment and it never got deployed, your guide was great step-by-step for decommission.

  2. NeighborGeek says:

    I overlooked the ‘publish-cstopology -finalizeuninstall’ step in your directions, as it is not exactly listed as a step to run, it looks like it’s listed inline with the example output from a previous command.

    Unfortunately, I didn’t realize I had missed a step until I got to ‘disable-csaddomain’ and it failed. The error pointed me to a log file, where I found this error message:
    “Error: Cannot remove the Active Directory settings for the domain due to “FE” still being activated.”

    Of course, once I realized I had missed a step, I tried to run it, but I believe the later steps, which are already completed, broke it so that I can’t run the publish-cstopology step now.

    Any suggestions on how to fix this?

    1. NeighborGeek says:

      Disregard. I was able to run “disable-csaddomain -force” successfully.


Skip to main content