Skip to content

Instantly share code, notes, and snippets.

@PCfromDCSnippets
Last active January 5, 2016 18:12
Show Gist options
  • Save PCfromDCSnippets/a13dc87d68e493d8794a to your computer and use it in GitHub Desktop.
Save PCfromDCSnippets/a13dc87d68e493d8794a to your computer and use it in GitHub Desktop.
Get Database Information
#region Get Database Info
$query1 = "SELECT name, physical_name AS CurrentLocation, state_desc
FROM sys.master_files
WHERE database_id = DB_ID(N'" + $dbName + "');"
Write-Verbose "Getting [$dbName] information..." -Verbose
$items = Invoke-Sqlcmd -Query $query1
Write-Output $items
#endregion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment