List all the Databases on a SQL Server.

Supported Platforms

SQL Server 2000
Yes


Script Code

strDBServerName = "."

Set objSQLServer = CreateObject("SQLDMO.SQLServer")
objSQLServer.LoginSecure = True
objSQLServer.Connect strDBServerName

Set colDatabases = objSQLServer.Databases

For Each objDatabase In colDatabases
WScript.Echo objDatabase.Name
Next

09-02 13:24