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

# Get-DbaClientAlias

## Synopsis

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

## Description

Retrieves all configured SQL Server client aliases by reading the Windows registry paths where SQL Server Native Client stores alias definitions. Client aliases allow DBAs to create friendly names that map to actual SQL Server instances, making connection strings simpler and more portable across environments. This is particularly useful when managing multiple instances, non-default ports, or when you need to abstract the actual server names from applications and connection strings.

## Syntax

```powershell
Get-DbaClientAlias
    [[-ComputerName] <DbaInstanceParameter[]>]
    [[-Credential] <PSCredential>]
    [-EnableException]
    [<CommonParameters>]

```

## Examples

### Example 1: Gets all SQL Server client aliases on the local computer

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

### Example 2: Gets all SQL Server client aliases on Workstationx

```powershell
PS C:\> Get-DbaClientAlias -ComputerName workstationx
```

### Example 3: Logs into workstationx as ad\sqldba then retrieves all SQL Server client aliases on Workstationx

```powershell
PS C:\> Get-DbaClientAlias -ComputerName workstationx -Credential ad\sqldba
```

### Example 4: Gets all SQL Server client aliases on Server1 and Server2

```powershell
PS C:\> 'Server1', 'Server2' | Get-DbaClientAlias
```

### Optional Parameters

##### -ComputerName

Specifies the computer(s) to retrieve SQL Server client aliases from. Accepts multiple computers via pipeline input.  
Use this when you need to audit client alias configurations across multiple workstations or servers in your environment.

| Property | Value |
| --- | --- |
| Alias |  |
| Required | False |
| Pipeline | true (ByValue) |
| 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 |

## Outputs

**PSCustomObject**

Returns one object per SQL Server client alias found in the registry. Each object represents a single alias configured on the specified computer(s).

**Properties:**

- ComputerName: The name of the computer where the client alias is configured
- NetworkLibrary: The network protocol type for the alias (TCP/IP or Named Pipes)
- ServerName: The target server name or instance (with protocol prefix removed)
- AliasName: The alias name as defined in the registry
- AliasString: The complete registry value including protocol prefix (e.g., DBMSSOCN,servername,1433)
- Architecture: The registry hive architecture where the alias was found (32-bit or 64-bit)

---

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