SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Script Library
 Finding Username and Password to all SQL servers
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

SwePeso
Patron Saint of Lost Yaks

Sweden
30265 Posts

Posted - 01/13/2007 :  15:33:25  Show Profile  Visit SwePeso's Homepage  Reply with Quote
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

Edited by - SwePeso on 01/29/2007 15:37:50

jezemine
Flowing Fount of Yak Knowledge

USA
2886 Posts

Posted - 01/13/2007 :  18:27:37  Show Profile  Visit jezemine's Homepage  Reply with Quote
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

Sweden
30265 Posts

Posted - 01/14/2007 :  04:20:11  Show Profile  Visit SwePeso's Homepage  Reply with Quote
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
Flowing Fount of Yak Knowledge

USA
2886 Posts

Posted - 01/14/2007 :  13:41:21  Show Profile  Visit jezemine's Homepage  Reply with Quote
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)

USA
7020 Posts

Posted - 01/29/2007 :  15:29:57  Show Profile  Reply with Quote
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

Sweden
30265 Posts

Posted - 01/29/2007 :  15:32:40  Show Profile  Visit SwePeso's Homepage  Reply with Quote
Thank you.
Typo on my behalf.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000