Page 1 of 1

Script: Count your SQL Databases with PowerShell

Posted: Tue Jun 18, 2019 12:29 pm
by hamid
Hello Club,

Here is a quick PowerShell Script which helps you to eassily count your SQL Databases and show you the result in a simple manner.

$sqlpassword = "PASSWORD" | ConvertTo-SecureString -asPlainText -Force
$sqlusername = "USERNAME"
$sqlcredential = New-Object System.Management.Automation.PSCredential($sqlusername,$sqlpassword)
$sqllist = Get-SqlDatabase -Credential $sqlcredential -ServerInstance INSTANCE NAME

Enjoy! :geek: