---
title: "Remove-DbaClientAlias"
description: "Removes SQL Server client aliases from Windows registry on local or remote computers"
url: "https://dbatools.io/Remove-DbaClientAlias/"
availability: "Windows only"
tags: ["SqlClient", "Alias"]
author: "Chrissy LeMaire (@cl), netnerds.net"
source: "https://github.com/dataplat/dbatools/blob/master/public/Remove-DbaClientAlias.ps1"
last_updated: "2024-01-01"
---

# Remove-DbaClientAlias

## Synopsis

Removes SQL Server client aliases from Windows registry on local or remote computers

## Description

Removes SQL Server client aliases from the Windows registry by deleting entries from both 32-bit and 64-bit registry locations.  
Client aliases redirect SQL Server connection requests to different servers or instances, but outdated or incorrect aliases can cause connection failures.  
This function provides a programmatic way to clean up these aliases when the deprecated cliconfg.exe utility is not available or when managing multiple computers remotely.  
Commonly used when decommissioning servers, updating connection strings, or troubleshooting connectivity issues caused by stale alias configurations.

## Syntax

```powershell
Remove-DbaClientAlias
    [[-ComputerName] <DbaInstanceParameter[]>]
    [[-Credential] <PSCredential>]
    [-Alias] <String[]>
    [-EnableException]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

```

## Examples

### Example 1: Removes the sqlps SQL Client alias on workstationX

```powershell
PS C:\> Remove-DbaClientAlias -ComputerName workstationX -Alias sqlps
```

### Example 2: Removes all SQL Server client aliases on the local computer

```powershell
PS C:\> Get-DbaClientAlias | Remove-DbaClientAlias
```

### Required Parameters

##### -Alias

Specifies the SQL Server client alias name(s) to remove from both 32-bit and 64-bit registry locations.  
Use this to clean up outdated aliases that redirect connections to decommissioned servers or incorrect instances.  
Accepts multiple alias names for bulk cleanup operations.

| Property | Value |
| --- | --- |
| Alias | AliasName |
| Required | True |
| Pipeline | true (ByPropertyName) |
| Default Value |  |

### Optional Parameters

##### -ComputerName

Specifies the target computer(s) where SQL Server client aliases will be removed from the Windows registry.  
Use this when you need to clean up aliases on remote workstations or application servers.  
Defaults to the local computer if not specified.

| Property | Value |
| --- | --- |
| Alias |  |
| Required | False |
| Pipeline | true (ByPropertyName) |
| Default Value | $env:COMPUTERNAME |

##### -Credential

Allows you to login to remote computers using alternative credentials

| Property | Value |
| --- | --- |
| Alias |  |
| Required | False |
| Pipeline | false |
| Default Value |  |

##### -EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.  
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.  
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.

| Property | Value |
| --- | --- |
| Alias |  |
| Required | False |
| Pipeline | false |
| Default Value | False |

##### -WhatIf

If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.

| Property | Value |
| --- | --- |
| Alias | wi |
| Required | False |
| Pipeline | false |
| Default Value |  |

##### -Confirm

If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.

| Property | Value |
| --- | --- |
| Alias | cf |
| Required | False |
| Pipeline | false |
| Default Value |  |

## Outputs

**PSCustomObject**

Returns one object per alias that was successfully removed from the registry.

**Properties:**

- ComputerName: The name of the computer where the alias was removed
- Architecture: Registry architecture where the alias was removed ("32-bit" or "64-bit")
- Alias: The name of the SQL Server client alias that was removed
- Status: The result status, typically "Removed" when successful

---

Part of [dbatools](https://dbatools.io/), a free and open source PowerShell module for SQL Server administration. Full command index: https://dbatools.io/commands/
