---
title: "Add-DbaInstanceList"
description: "Adds one or more SQL Server instances to the user-maintained autocomplete list."
url: "https://dbatools.io/Add-DbaInstanceList/"
availability: "Windows, Linux, macOS"
tags: ["TabCompletion", "Autocomplete"]
author: "the dbatools team + Claude"
source: "https://github.com/dataplat/dbatools/blob/master/public/Add-DbaInstanceList.ps1"
last_updated: "2024-01-01"
---

# Add-DbaInstanceList

## Synopsis

Adds one or more SQL Server instances to the user-maintained autocomplete list.

## Description

Adds SQL Server instance names to a persistent list that pre-populates the tab completion  
cache for the -SqlInstance parameter across all dbatools commands. This allows users to  
have their frequently used instances available for autocomplete in their PowerShell  
terminal without needing to connect to them first.  
  
The instance list is stored using the dbatools configuration system. Use -Register to  
persist the list across PowerShell sessions.  
  
Instances can also be pre-loaded at module import time by setting the  
$env:DBATOOLS_KNOWN_INSTANCES environment variable to a comma-separated list of instance  
names in your PowerShell profile.

## Syntax

```powershell
Add-DbaInstanceList
    [-SqlInstance] <String[]>
    [-Register]
    [[-Scope] {UserDefault | UserMandatory | SystemDefault | SystemMandatory | FileUserLocal | FileUserShared | FileSystem}]
    [<CommonParameters>]

```

## Examples

### Example 1: Adds sql01 and sql02\dev to the autocomplete instance list for the current session

```powershell
PS C:\> Add-DbaInstanceList -SqlInstance "sql01", "sql02\dev"
```

### Example 2: Adds sql01 to the autocomplete instance list and persists it across PowerShell sessions

```powershell
PS C:\> Add-DbaInstanceList -SqlInstance "sql01" -Register
```

### Example 3: Adds two instances to the list via pipeline and persists them across sessions

```powershell
PS C:\> "sql01", "sql02" | Add-DbaInstanceList -Register
```

### Required Parameters

##### -SqlInstance

The SQL Server instance name or names to add to the autocomplete list.  
Accepts pipeline input.

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

### Optional Parameters

##### -Register

Persists the instance list to disk so it is available in future PowerShell sessions.  
Without this switch, the list only exists for the current session.

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

##### -Scope

Determines where the persistent configuration is stored when using -Register.  
UserDefault stores the setting for the current user only.

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

## Outputs

**None**

This command updates the autocomplete cache but does not output any objects to the pipeline. Use Get-DbaInstanceList to retrieve the configured instance names.

---

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