Wednesday, March 7, 2012

Can I use osql to known the database install on a server via guest ?

Can I use osql to known the database install on a server via 'guest'
account ?

I had over 300 servers with sql server all around France (different
version : 6.5, 7 and 8)
I need to check all database on each servers from my place.
Of course, also it would have been to easy, I don't have all 'sa'
password...

Is that possible to use the 'guest' account to execute a query like
this via osql :

Extract.sql
exec sp_helpdb

Extract.cmd
for /f "usebackq tokens=1 delims=\n" %%i IN (ListServer.txt) DO
osql
-S%%i -Uguest -P -dmaster -i"C:\Extraction\Extract.sql"
-o"C:\Extraction\%%i.rpt"

Could I query 'master' with the 'guest' account ?
Or any other ideas how to do this by an other way ?

ThanksFlorimond (florimond@.gmail.com) writes:
> Can I use osql to known the database install on a server via 'guest'
> account ?
> I had over 300 servers with sql server all around France (different
> version : 6.5, 7 and 8)
> I need to check all database on each servers from my place.
> Of course, also it would have been to easy, I don't have all 'sa'
> password...
> Is that possible to use the 'guest' account to execute a query like
> this via osql :

"guest" is not a login, it's only a database user. To connect to SQL
Server you must either have a valid username/password for SQL
authentication, or your Windows login must have been granted access
to the server.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

No comments:

Post a Comment