Skip to content

Instantly share code, notes, and snippets.

@martin9700
Created November 30, 2014 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save martin9700/978a5a0a5861127be4f7 to your computer and use it in GitHub Desktop.
Save martin9700/978a5a0a5861127be4f7 to your computer and use it in GitHub Desktop.
Begin {
If ($ListDatabases)
{ $Database = "Master"
$Query = "Select Name,state_desc as [State],recovery_model_desc as [Recovery Model] From Sys.Databases"
}
If (-not $Query)
{ $Path = Join-Path -Path $env:TEMP -ChildPath "Invoke-SQLQuery-Query.txt"
Start-Process Notepad.exe -ArgumentList $Path -Wait
$Query = Get-Content $Path
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment