At times we might run into a situation where we would need to remove all the server roles, remove the features and front end roles in our Lync environment like in a disaster recovery scenario or Lync server upgrade.

In this article, we will have a look at the steps to decommission the Lync servers in an existing deployment.

Based on experience, we have gathered a few steps which should be useful to troubleshoot in these kinds of scenarios.


1. Disable users

Disable all users that are enabled for Lync Server and conferencing directories. You can run the below command:

Get-CSuser | Disable-CSuser
 Get-CsConferenceDirectory | Remove-CsConferenceDirectory

2. Remove UM contact objects

2A. Remove Exchange Unified Messaging (UM) Contact Objects:

Get-CsExUmContact -Filter {RegistrarPool -eq "<LyncServerPoolFqdn>"} | Remove-CsExUmContact

2B.  Remove Response Group Service Workflow Contact Objects:

Get-CsRgsWorkflow -Identity:Service:ApplicationServer:<LyncServerPoolFqdn> | Remove-CsRgsWorkflow

2C. Remove Dial-in Conferencing Access Number Contact Objects:

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

3 . Reassign the PSTN Gateway:

Set-CsPstnGateway -Identity "PstnGateway:<Xds Identity of PSTN Gateway>" -MediationServer:"MediationServer: <Name of Mediation Server Identity>"

4. Front end

Confirm that a Front End Pool or Front End Server is Vacant:

Get-CsVoiceRoute | select Identity,PstnGatewayList

5. Topology cleanup

Delete all the server roles in the topology, and then publish the final, empty topology.

  • Log on to the computer where Topology Builder is installed.
  • Start Topology Builder: Click Start, click All Programs, click Microsoft Lync Server 2010, and then click Lync Server Topology Builder.
  • In the Actions pane, click Remove Deployment.
  • Read the information regarding Remove Deployment
  • Click Next, and then click Finish.

Once the above is done you can open topology builder and publish the empty topology by choosing the option Download Topology from existing deployment.


Uninstall all Lync related SQL database.

Uninstall-CsDatabase -DatabaseType User -SqlServerFqdn[-SqlInstanceName <instance name>]

7. Central store

 Run “Remove-CsConfigurationStoreLocation” to remove the Central Management store service control point (SCP) for the existing Central Management store in Active Directory Domain Services (AD DS).

Remove the Central Management Store Service Control Point in Active Directory Domain Services (Optional)

 Unprep the domain.


Disable-CsAdDomain -Domain -GlobalSettingsDomainController -Force

Unprep the forest.


Disable-CsAdForest -Force -GroupDomain

After doing the above, you should be able to start a new deployment.