Skip to content

Instantly share code, notes, and snippets.

@RichieBzzzt
Last active May 15, 2022 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RichieBzzzt/8f67dc6d82a0935b432cbcd4f2954873 to your computer and use it in GitHub Desktop.
Save RichieBzzzt/8f67dc6d82a0935b432cbcd4f2954873 to your computer and use it in GitHub Desktop.
cls
$sql_connection_string = "SERVER=.;Integrated Security=True;Database=master"
$sql_connection = new-object System.Data.SqlClient.SqlConnection ($sql_connection_string)
try {
$sql_connection.Open()
return $sql_connection.Database
}
catch {
Write-Error $_.Exception
Throw
}
$sql_connection.Dispose();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment