Topic Last Modified: 2010-10-01

Deletes the specified Microsoft Lync Server 2010 database.

Syntax

Uninstall-CsDatabase -DatabaseType <Application | Archiving | Monitoring | User | Provision> -SqlServerFqdn <Fqdn> [-Confirm [<SwitchParameter>]] [-Detach <SwitchParameter>] [-Force <SwitchParameter>] [-Report <String>] [-SqlInstanceName <String>] [-WhatIf [<SwitchParameter>]]
Uninstall-CsDatabase -CentralManagementDatabase <SwitchParameter> -SqlServerFqdn <Fqdn> [-Confirm [<SwitchParameter>]] [-Detach <SwitchParameter>] [-Force <SwitchParameter>] [-Report <String>] [-SqlInstanceName <String>] [-WhatIf [<SwitchParameter>]]

Parameters

Parameter Required Type Description

SqlServerFqdn

Required

String

Fully qualified domain name (FQDN) of the computer or SQL Server cluster where the database is located. For example: -SqlServer atl-sql-001.litwareinc.com.

CentralManagementDatabase

Optional

Switch Parameter

If present, uninstalls the Central Management store. You cannot use both CentralManagementDatabase and DatabaseType in the same command.

DatabaseType

Optional

String

Database to be deleted. Valid values are:

Application

Archiving

Monitoring

Provision

User

To delete the Central Management store, use the CentralManagementDatabase parameter.

Detach

Optional

Switch Parameter

If present, detaches the specified database. When a database is detached, all the file locks imposed by SQL Server are removed. This enables you to directly access the database files in order to do such things as copy those files to another computer.

SqlInstanceName

Optional

String

Name of the database instance containing the database to be removed. A database instance is a set of running processes that provides access to database files.

Force

Optional

Switch Parameter

If present, forces removal of the database even if that database is currently in use.

Report

Optional

String

Enables you to specify a file path for the log file created when the cmdlet runs. For example: -Report "C:\Logs\UninstallDatabase.html"

WhatIf

Optional

Switch Parameter

Describes what would happen if you executed the command without actually executing the command.

Confirm

Optional

Switch Parameter

Prompts you for confirmation before executing the command.

Detailed Description

Lync Server 2010 makes extensive use of SQL Server databases such as the Central Management store and the Archiving database. These databases are set up at the same time you install Lync Server 2010 or at the same time you install a Lync Server 2010 role (such as Monitoring Server) that requires a database back end. After the databases have been installed, you will rarely need to uninstall them.

However, it is possible that you might need to uninstall a Lync Server 2010 database at some point; for example, a hardware failure or an issue with network connectivity might make an existing database unusable. Regardless of the reason, the Uninstall-CsDatabase cmdlet provides a way for you to remove or detach any of the SQL Server databases used by Lync Server 2010.

Who can run this cmdlet: You must be a member of the domain, a SQL Server administrator, and a local administrator on the computer where SQL Server is installed in order to run the Uninstall-CsDatabase cmdlet locally. To return a list of all the role-based access control (RBAC) roles this cmdlet has been assigned to (including any custom RBAC roles you have created yourself), run the following command from the Windows PowerShell prompt:

Get-CsAdminRole | Where-Object {$_.Cmdlets –match "Uninstall-CsDatabase"}

Input Types

None. Uninstall-CsDatabase does not accept pipelined input.

Return Types

Uninstall-CsDatabase does not return any values or objects.

Example

-------------------------- Example 1 ------------------------

Copy Code
Uninstall-CsDatabase -CentralManagementDatabase -SqlServerFqdn atl-sql-001.litwareinc.com 

The command shown in Example 1 deletes the Central Management store from the computer atl-sql-001.litwareinc.com.

-------------------------- Example 2 ------------------------

Copy Code
Uninstall-CsDatabase -DatabaseType User -SqlServerFqdn atl-sql-001.litwareinc.com 

In Example 2, the User database is deleted from the computer atl-sql-001.litwareinc.com. When you use the DatabaseType parameter, all stores related to the specified database are deleted.

See Also

Other Resources

Install-CsDatabase