< Back

New-DbaConnectionStringBuilder

Mon Jan 13, 2020 12:46 pm

NAME New-DbaConnectionStringBuilder



SYNOPSIS

Returns a System.Data.SqlClient.SqlConnectionStringBuilder with the string specified





SYNTAX

New-DbaConnectionStringBuilder [[-ConnectionString] <System.String[]>] [[-ApplicationName] <String>]

[[-DataSource] <String>] [[-InitialCatalog] <String>] [[-IntegratedSecurity] <System.Nullable`1[[System.Boolean,

mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]>] [[-UserName] <String>]

[[-Password] <String>] [-MultipleActiveResultSets <Switch>] [[-ColumnEncryptionSetting]

<System.Data.SqlClient.SqlConnectionColumnEncryptionSetting>] [[-WorkstationId] <String>] [<CommonParameters>]





DESCRIPTION

Creates a System.Data.SqlClient.SqlConnectionStringBuilder from a connection string.





PARAMETERS

-ApplicationName [<String>]

The application name to tell SQL Server the connection is associated with.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-ColumnEncryptionSetting [<System.Data.SqlClient.SqlConnectionColumnEncryptionSetting>]

Enable Always Encrypted.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-ConnectionString [<System.String[]>]

A Connection String



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-DataSource [<String>]

The Sql Server to connect to.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-InitialCatalog [<String>]

The initial database on the server to connect to.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-IntegratedSecurity [<System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral,

PublicKeyToken=b77a5c561934e089]]>]

Set to true to use windows authentication.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-MultipleActiveResultSets [<Switch>]

Enable Multiple Active Result Sets.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Password [<String>]

Password to use to connect with.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-UserName [<String>]

Sql User Name to connect with.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-WorkstationId [<String>]

Set the Workstation Id that is associated with the connection.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES





Tags: SqlBuild, ConnectionString, Connection

Author: zippy1981 | Chrissy LeMaire (@cl)



Website: https://dbatools.io

Copyright: (c) 2018 by dbatools, licensed under MIT

License: MIT https://opensource.org/licenses/MIT



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>New-DbaConnectionStringBuilder



Returns an empty ConnectionStringBuilder

-------------------------- EXAMPLE 2 --------------------------



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.



RELATED LINKS

https://dbatools.io/New-DbaConnectionStringBuilder