Author | zippy1981 , Chrissy LeMaire (@cl) |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out New-DbaConnectionStringBuilder on GitHub.
Want to see the Bill Of Health for this command? Check out New-DbaConnectionStringBuilder.
Returns a Microsoft.Data.SqlClient.SqlConnectionStringBuilder with the string specified
Creates a Microsoft.Data.SqlClient.SqlConnectionStringBuilder from a connection string.
New-DbaConnectionStringBuilder
[[-ConnectionString] <String[]>]
[[-ApplicationName] <String>]
[[-DataSource] <String>]
[[-SqlCredential] <PSCredential>]
[[-InitialCatalog] <String>]
[-IntegratedSecurity]
[[-UserName] <String>]
[[-Password] <String>]
[-MultipleActiveResultSets]
[[-ColumnEncryptionSetting] <String>]
[-Legacy]
[-NonPooledConnection]
[[-WorkstationId] <String>]
[<CommonParameters>]
PS C:\> New-DbaConnectionStringBuilder
Returns an empty ConnectionStringBuilder
PS C:\> "Data Source=localhost,1433;Initial Catalog=AlwaysEncryptedSample;UID=sa;PWD=alwaysB3Encrypt1ng;Application Name=Always Encrypted Sample MVC App;Column Encryption Setting=enabled" |
New-DbaConnectionStringBuilder
Returns a connection string builder that can be used to connect to the local sql server instance on the default port.
A Connection String
Alias | |
Required | False |
Pipeline | true (ByValue) |
Default Value |
The application name to tell SQL Server the connection is associated with.
Alias | |
Required | False |
Pipeline | false |
Default Value | dbatools Powershell Module |
The target SQL Server instance or instances. This can be a collection and receive pipeline input to allow the function to be executed against multiple SQL Server instances.
Alias | SqlInstance |
Required | False |
Pipeline | false |
Default Value |
Credential object used to connect to the SQL Server Instance as a different user. This can be a Windows or SQL Server account. Windows users are determined by the existence of a backslash, so if you
are intending to use an alternative Windows connection instead of a SQL login, ensure it contains a backslash.
Alias | |
Required | False |
Pipeline | false |
Default Value |
The initial database on the server to connect to.
Alias | Database |
Required | False |
Pipeline | false |
Default Value |
Sets to use windows authentication.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Sql User Name to connect with. Consider using SqlCredential instead.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Password to use to connect with. Consider using SqlCredential instead.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Enable Multiple Active Result Sets.
Alias | MARS |
Required | False |
Pipeline | false |
Default Value | False |
Enable Always Encrypted.
Alias | AlwaysEncrypted |
Required | False |
Pipeline | false |
Default Value | |
Accepted Values | Enabled |
Use this switch to create a connection string using System.Data.SqlClient instead of Microsoft.Data.SqlClient.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
If this switch is enabled, a non-pooled connection will be requested.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Set the Workstation Id that is associated with the connection.
Alias | |
Required | False |
Pipeline | false |
Default Value | $env:COMPUTERNAME |