Specify Instances in the SQL Server PowerShell Provider
The paths specified for the SQL Server PowerShell provider must identify the instance of the Database Engine and the computer it is running on. The syntax for specifying the computer and the instance must comply with both the rules for SQL Server identifiers and Windows PowerShell paths.
The first node following the SQLSERVER:\SQL in a SQL Server provider path is the name of the computer that is running the instance of the Database Engine; for example:
If you are running Windows PowerShell on the same computer as the instance of the Database Engine, you can use either localhost or (local) instead of the name of the computer. Scripts that use localhost or (local) can be run on any computer without having to be changed to reflect the different computer names.
You can run multiple instances of the Database Engine executable program on the same computer. The node following the computer name in a SQL Server provider path identifies the instance; for example:
Each computer can have one default instance of the Database Engine. You do not specify a name for the default instance when you install it. If you specify only a computer name in a connection string, you are connected to the default instance on that computer. All other instances on the computer must be named instances. You specify the instance name during setup, and connection strings must specify both the computer name and the instance name.
Limitations and Restrictions
You cannot use a period (.) to specify the local computer in PowerShell scripts. The period is not supported because the period is interpreted as a command by PowerShell.
The parenthesis characters in (local) are normally treated as commands by Windows PowerShell. You must either encode them or escape them for use in a path, or enclose the path in double-quotation marks. For more information, see Encode and Decode SQL Server Identifiers.
The SQL Server provider requires that you always specify an instance name. For default instances, you must specify an instance name of DEFAULT.
This example uses localhost and DEFAULT to specify the default instance on the local computer:
The parenthesis characters in (local) are normally treated as commands by Windows PowerShell. You must either:
Enclose the path string in quotes:
Escape the parenthesis using the back tick character (`):
Encode the parenthesis using their hexadecimal representation: