Skip to content

Instantly share code, notes, and snippets.

@phwelo
Last active February 5, 2018 19:08
Show Gist options
  • Save phwelo/4c994865e49dd3def92ba5679bc681de to your computer and use it in GitHub Desktop.
Save phwelo/4c994865e49dd3def92ba5679bc681de to your computer and use it in GitHub Desktop.
[Connection String Builder] Builds a connection string based on parameters #Powershell #SQL
function New-ConnectionString($Server,$Catalog,[bool]$PersistSecurity,$User,$Password) {
$ConnectionString = "Data Source=$Server;Initial Catalog=$Catalog;Persist Security Info=$([string]$PersistSecurity);User ID=$User;Password=$Password"
return $ConnectionString
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment