Get-SqlConnection
Gets a ServerConnection.
Syntax
Get-SqlConnection [-sqlserver] <String> [[-username] <String>] [[-password] <String>] [<CommonParameters>]
Detailed Description
The Get-SqlConnection function gets a ServerConnection to the specified SQL Server.
Related Commands
Parameters
Name |
Description |
Required? |
Pipeline Input |
Default Value |
sqlserver |
|
true |
false |
|
username |
|
false |
false |
|
password |
|
false |
false |
|
Input Type
None
You cannot pipe objects to Get-SqlConnection
Return Values
Microsoft.SqlServer.Management.Common.ServerConnection
Get-SqlConnection returns a Microsoft.SqlServer.Management.Common.ServerConnection object.
Examples
EXAMPLE 1
Get-SqlConnection "Z002\sql2K8"
This command gets a ServerConnection to SQL Server Z002\SQL2K8.
EXAMPLE 2
Get-SqlConnection "Z002\sql2K8" "sa" "Passw0rd"
This command gets a ServerConnection to SQL Server Z002\SQL2K8 using SQL authentication.