The most common reasons I have seen for uninstalling Office Communications Server 2007 from an environment are typically to remove a pre-release beta version or test deployment, or to start from scratch after a botched deployment.  In either scenario it’s often desired to completely remove all aspects of OCS and start fresh.  This approach is often started by simply uninstalling the OCS components from the Front-End server, and doing so will generate this alert:


If ‘Yes’ is chosen and all other component removed, then the Active Directory forest and domain(s) will still contain remnants of OCS and promptly beginning a new installation in the same forest will probably lead to even more problems then before.  There is a little more to it than just running the Add/Remove Programs wizard.

Supported Uninstall Path

The correct order of steps to completely uninstall OCS 2007 are:

  1. Deactivate Servers
  2. Uninstall Software Components
  3. Unprep Domain and Forest

Deactivating Servers

Each registered server component (e.g. Standard Edition Front-End, Edge, Web Components, Mediation) can be deactivated by using either the Management Console or the LCSCmd.exe command utility.

The simplest way is to use the console and navigate to the menu shown below:


But if the server components have already been uninstalled and the console is therefor also removed, then the command line must be used.  Since the server files have been removed then the LCSCmd.exe command must be run from the setup\i386 directory of the OCS installation files.  The OCS 2007 Administration Guide contains all of the documented switches and examples required to deactivate and unprep components, but here are some examples for removing common components.

Deactivate Standard Edition Server lcscmd.exe /Server /Role:SE /Action:Deactivate /Force
Deactivate Enterprise Edition Server lcscmd.exe /Server /Role:EE /Action:Deactivate /Force
Deactivate Consolidated Edge Server lcscmd.exe /Server /Role:AP /Components:AP,DP,MR /Action:Deactivate /Force
Deactivate Proxy Server lcscmd.exe /Server /Role:Proxy /Action:Deactivate /Force
Deactivate WorkGroupProxy Server lcscmd.exe /Server /Role:WorkGroupProxy /Action:Deactivate /Force
Deactivate Web Components Server lcscmd.exe /Web /Action:Deactivate /Force
Deactivate Mediation Server lcscmd.exe /MedServer /Action:Deactivate /Force


If the original server has been completely removed from the domain, then issuing the command from another server requires a slightly different format in order to specify the desired AD object:

lcscmd.exe /Server:ocs1.schertz.lab /Action:Deactivate /Role:SE /Refdomain:schertz.lab

Removing Programs

After deactivating all components then uninstall each program on the server(s).


When removing the Standard Edition Server component, uncheck the option to "Keep the user database" to have the local SQL database files deleted by the process.  The folders will still reside on the local disk (by default C:\LC Data and C:\LC Log) but will be empty.

Unprepping the Forest

The final steps are to remove the related configuration information in Active Directory.  Note that the Schema extensions created by the original SchemaPrep step can not be removed, but if the eventual goal is to reinstall OCS then this present no problems.  The Schema extensions are generic and contain no instance-specific configuration information.  By unprepping the Domain and Forest, all configuration information will be removed.

lcscmd.exe /Domain:schertz.lab /Action:DomainUnPrep

lcscmd.exe /Forest:schertz.lab /Action:ForestUnprep

After allowing for any AD replication to fully complete, a new installation of OCS can be started.  I’d recommend using a new, unique server name for the second go-around just to be on the safe side.

By Jeff Schertz

Site Administrator

11 thoughts on “Uninstalling OCS 2007”
  1. Hi Jeff. We upgraded from OCS 2007 to Lync 2010 to Lync 2013. I'm removing OCS 2007 and have finished deactivating and uninstalling the different parts. I'd still want to do the unpreps even though I'm not going to setup another OCS instance right? It won't affect our Lync deployement at all?

    1. No, you do not want to unprep the domain if you have other, newer Communications Server roles like Lync Servers.

  2. Thanks. I also see in MS documentation that these groups can be deleted, but again, is that true if you have newer versions like Lync installed?

    In Active Directory Users and Computers, locate and delete the following RTC service accounts:

    1. Those accounts are not used by Lync Server, only OCS. Since Lync 2010 the individual services no longer run under AD user accounts.

  3. Hello;

    You indicated removing the software, then running the LCSCMD command to remove the configuration from the domain and forest, but the uninstall removes LCSCMD from the OCS server. Do you mean we should run the LCSCMD command from the original installation media? Also, should that be run from the OCS server, or on the domain controller directly, if running from installation media, or does it not matter?

    1. Scott, that is a very old article and I can’t say at this point. AS long as you have the proper rights it shouldn’t matter, but if you get any errors then try running from a different server.

  4. We are moving from OCS 2007 R2 to Skype for Business on Office 365. We utilize DirSync for Office 365 from our domain. Since Skype is in Office 365 can we still run the domain and forest unprepping? I wasn’t sure if it would affect anything from DirSync of user accounts to Office 365.

        1. I’ve got the same scenario. I turned our OCS server off when we deployed O365. I was thinking about turning it on to remove it from the domain, and follow this guide, which I found over a year ago. There haven’t been any problems relating to OCS that I have noticed. We do have sloow autodiscover record lookups, relating to an exchange server we used to run (before my time) which might be impacting on Lync online. Jeff, what did you decide to do? Cheers, Julian.

  5. Jeff, we migrated ocs 2007 to Lync 2010 about 4 years ago, but just never completed the decommission of ocs2007. now, I have gone through the process but when I try the removal of the Enterprise pool, the scripts can’t access the data drive on the SQL server. My server team is telling me it looks like that server is having OS issues, so I need to try to complete the removal of the Enterprise Pool manually, before I update the Lync 2010 topology. What is the best method to do that?

Leave a Reply

Your email address will not be published. Required fields are marked *