Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Audit your sa logins

Author  Topic 

jasper_smith
SQL Server MVP & SQLTeam MVY

846 Posts

Posted - 2002-05-22 : 13:59:20
Had to do this today in response to the various security alerts
so wrote a little script to do it for me - hope its useful to someone

copy and paste into notepad and save as auditsa.vbs and run it from
the command line to get a report in file sqlservers.txt (Since it uses
the SQLSMO ListAvailableServers method it is limited to the local
subnet I believe although if you have aliases set up it should use them)

cscript auditsa.vbs >sqlservers.txt

HTH
Jasper Smith

'Audit subnet for Servers with blank sa password

Dim oApp
Dim oServer
Dim oDatabase
Dim oNames
Dim oName

Set oApp = CreateObject("SQLDMO.Application")
Set oNames = oApp.ListAvailableSQLServers()

On Error Resume Next

For Each oName In oNames

Set oServer = CreateObject("SQLDMO.SqlServer")
oServer.LoginSecure = False
oServer.LoginTimeout= 30
oServer.Connect oName,"sa",""

If Err.Number=0 Then
WScript.Echo "!!!Server " & oName & " has a blank sa password"
WScript.Echo oServer.VersionString
WScript.Echo ""
End If


oServer.DisConnect
Set oServer = Nothing
Err.Clear
Next

oApp.Quit
Set oApp = Nothing
Wscript.Quit


   

- Advertisement -