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
 General SQL Server Forums
 Script Library
 Finding Username and Password to all SQL servers

Author  Topic 

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-13 : 15:33:25
Are you one of those, like me, who has plenty of SQL Servers in Enterprise Manager, but have forgot over the time which username and password you used to add the SQL Server to the list of servers and groups?

Run this VbScript code!
Dim oApp, lServer, lGroups

Set oApp = CreateObject("SQLDMO.Application")

For lGroups = 1 to oApp.ServerGroups.Count
For lServer = 1 To oApp.ServerGroups(lGroups).RegisteredServers.Count
MsgBox oApp.ServerGroups(lGroups).Name & " - " & _
oApp.ServerGroups(lGroups).RegisteredServers(lServer).Name & " - " & _
oApp.ServerGroups(lGroups).RegisteredServers(lServer).Login & " - " & _
oApp.ServerGroups(lGroups).RegisteredServers(lServer).Password & " - " & _
oApp.ServerGroups(lGroups).RegisteredServers(lServer).UseTrustedConnection
Next
Next

Set oApp = Nothing
EDIT: Typos


Peter Larsson
Helsingborg, Sweden

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-01-13 : 18:27:37
as I recall DMO uses per-user encryption for this information in the registry so thankfully this can't be used to fetch others' passwords. at least I don't think it can.


www.elsasoft.org
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-14 : 04:20:11
It shows, in plaintext, every username and password used to connect to each and one server...


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-01-14 : 13:41:21
when I said per-user, i meant per windows user. if you log in to your box with a different windows account, do you see the same list of regservers, etc?


www.elsasoft.org
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2007-01-29 : 15:29:57
quote:
Originally posted by Peso

Are you one of those, like me, who has plenty of SQL Servers in Enterprise Manager, but have forgot over the time which username and password you used to add the SQL Server to the list of servers and groups?

Run this VbScript code!
Dim oApp, lServer, lGroups

Set oApp = CreateObject("SQLDMO.Application")

For lGroups = 1 to oApp.ServerGroups.Count
For lServer = 1 To oApp.ServerGroups(lGroups).RegisteredServers.Count
MsgBox App.ServerGroups(lGroups).Name & " - " & _
App.ServerGroups(lGroups).RegisteredServers(lServer).Name & " - " & _
App.ServerGroups(lGroups).RegisteredServers(lServer).Login & " - " & _
App.ServerGroups(lGroups).RegisteredServers(lServer).Password & " - " & _
App.ServerGroups(lGroups).RegisteredServers(lServer).UseTrustedConnection
Next
Next

Set oApp = Nothing


Peter Larsson
Helsingborg, Sweden



I think it has to be changed to this (oApp instead of App):

Dim oApp, lServer, lGroups

Set oApp = CreateObject("SQLDMO.Application")

For lGroups = 1 to oApp.ServerGroups.Count
For lServer = 1 To oApp.ServerGroups(lGroups).RegisteredServers.Count
MsgBox oApp.ServerGroups(lGroups).Name & " - " & _
oApp.ServerGroups(lGroups).RegisteredServers(lServer).Name & " - " & _
oApp.ServerGroups(lGroups).RegisteredServers(lServer).Login & " - " & _
oApp.ServerGroups(lGroups).RegisteredServers(lServer).Password & " - " & _
oApp.ServerGroups(lGroups).RegisteredServers(lServer).UseTrustedConnection
Next
Next

Set oApp = Nothing




CODO ERGO SUM
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-29 : 15:32:40
Thank you.
Typo on my behalf.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -