| title | Remove an Instance of SQL Server from the SQL Server Utility | Microsoft Docs | |
|---|---|---|
| ms.custom | ||
| ms.date | 03/14/2017 | |
| ms.prod | sql | |
| ms.prod_service | database-engine | |
| ms.reviewer | ||
| ms.technology | configuration | |
| ms.topic | conceptual | |
| f1_keywords |
|
|
| ms.assetid | ae1d126a-46d2-47bf-b339-17c743df6491 | |
| author | MikeRayMSFT | |
| ms.author | mikeray |
[!INCLUDEappliesto-ss-xxxx-xxxx-xxx-md] Use the following steps to remove a managed instance of [!INCLUDEssNoVersion] from the [!INCLUDEssNoVersion] Utility. This procedure removes the instance of [!INCLUDEssNoVersion] from the UCP list view and [!INCLUDEssNoVersion] Utility data collection stops. The instance of [!INCLUDEssNoVersion] is not uninstalled.
Important
Before you use this procedure to remove an instance of [!INCLUDEssNoVersion] from the [!INCLUDEssNoVersion] Utility, make sure that the [!INCLUDEssNoVersion] and SQL Server Agent services are running on the instance to remove.
-
From the Utility Explorer in [!INCLUDEssManStudioFull], click on Managed Instances. Observe the list view of managed instances of [!INCLUDEssNoVersion] in the Utility Explorer content pane.
-
In the SQL Server Instance Name column of the list view, select the [!INCLUDEssNoVersion] instance to remove from the [!INCLUDEssNoVersion] Utility. Right-click on the instance to remove, and select Remove Managed Instance....
-
Specify credentials with administrator privileges for the instance of [!INCLUDEssNoVersion]: Click Connect..., verify the information in the Connect to Server dialog box, then click Connect. You will see the login information on the Remove Managed Instance dialog.
-
To confirm the operation, click OK. To quit the operation, click Cancel.
This procedure removes the instance of [!INCLUDEssNoVersion] from the UCP list view and stops [!INCLUDEssNoVersion] Utility data collection. The instance of [!INCLUDEssNoVersion] is not uninstalled.
To use PowerShell to remove a managed instance of [!INCLUDEssNoVersion] from the [!INCLUDEssNoVersion] Utility. This script performs the following operations:
-
Gets the UCP by server instance name.
-
Removes the managed instance of [!INCLUDEssNoVersion] from the [!INCLUDEssNoVersion] Utility.
# Get Ucp connection
$UcpServerInstanceName = "ComputerName\InstanceName";
$UtilityInstance = new-object -Type Microsoft.SqlServer.Management.Smo.Server $UcpServerInstanceName;
$UcpConnection = new-object -Type Microsoft.SqlServer.Management.Sdk.Sfc.SqlStoreConnection $UtilityInstance.ConnectionContext.SqlConnectionObject;
$Utility = [Microsoft.SqlServer.Management.Utility.Utility]::Connect($UcpConnection);
# Now remove the ManagedInstance from the SQL Server Utility
$ServerInstanceName = "ComputerName\InstanceName";
$Instance = new-object -Type Microsoft.SqlServer.Management.Smo.Server $ServerInstanceName;
$InstanceConnection = new-object -Type Microsoft.SqlServer.Management.Sdk.Sfc.SqlStoreConnection $Instance.ConnectionContext.SqlConnectionObject;
$ManagedInstance = $Utility.ManagedInstances[$ServerInstanceName];
$ManagedInstance.Remove($InstanceConnection);
Note that it is important to refer to the [!INCLUDEssNoVersion] instance name exactly as it is stored in [!INCLUDEssNoVersion]. On a case-sensitive instance of [!INCLUDEssNoVersion], you must specify the instance name using the exact casing as returned by @@SERVERNAME. To get the instance name for the managed instance of [!INCLUDEssNoVersion], run this query on the managed instance:
select @@SERVERNAME AS instance_name
At this point, the managed instance of [!INCLUDEssNoVersion] is fully removed from the UCP. It disappears from the list view the next time you refresh data for the [!INCLUDEssNoVersion] Utility. This state is identical to a user successfully going through the remove managed instance operation in the SSMS user interface.
Use Utility Explorer to Manage the SQL Server Utility
Troubleshoot the SQL Server Utility