Share via


PowerShell: Count SQLServer Databases

Hello Wiki,

I've made a simple PowerShell Script which helps you to count your SQLServer Databases in an easily way with just clicking simoly on It.

Here It is:

$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
$sqllist.count

Hope that will effective.