Re: Getting the sa password with SQLDMO

From: Dan Guzman (guzmanda_at_nospam-online.sbcglobal.net)
Date: 12/27/04


Date: Sun, 26 Dec 2004 23:09:47 -0600

SQL Server stores passwords using a one-way hash so you can't read the
existing password into a clear text string. You could accomplish the
conditional password change by attempting a connection using the expected sa
password and, if it fails, connect using a different sysadmin role member
login to change the password as desired.

However, the need for such a script strikes me as odd. Only sysadmin role
member can change the sa password. I would hope that your sysadmin role
members don't change the sa password indiscriminately.

-- 
Happy Holidays
Dan Guzman
SQL Server MVP
"Otis" <stephenprescott.TAKEOUTSPAM.@msn.com> wrote in message 
news:eDTHw%2386EHA.208@TK2MSFTNGP12.phx.gbl...
> Hi,
>
> I have a failsafe routine that checks the sa password to make sure that it
> has not been changed. I can reset it like this:
>
> If objLogin.Name = "sa" Then objLogin.SetPassword vbNullString,
> "Somepassword"
>
> But it seems a little sloppy to be setting this password again and again
> when it never changes. Is there a way to discover the password with SQLDMO
> so I can see if it has changed before I go setting it again?
>
> Thanks.
>
> Steve
>
> 


Relevant Pages

  • Re: Discrepancy in number of rows and size of database
    ... How do I make sure that I'm a member of the SysAdmin role? ... with this tool you can catch all commands SQL Server is receiving. ... >> I'm trying to help a customer extract some data out of their SQL Server ...
    (microsoft.public.sqlserver.server)
  • Re: Other way of Changing Password if does not have Server Role
    ... A user can change his password without being a member of the sysadmin role. ... You just have to login as the user and then omit the 3rd parameter ... Dejan Sarka, SQL Server MVP ...
    (microsoft.public.sqlserver.security)
  • Re: DTS Sucess but fails to go to next step when scheduled
    ... If == a member of the sysadmin role then log in as the account under which the ... Now try the package ... If!= A member of the sysadmin rol then log in as the proxy accunt and try the ... Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. ...
    (microsoft.public.sqlserver.dts)
  • Re: Does MSSQL service account rights
    ... but does it have to be a member of the ... I have a SQL Server that runs under a domain account. ... that membership in the sysadmin role is not required. ... >> Does the MSSQL Service domain service account have to be a member of the ...
    (microsoft.public.sqlserver.security)
  • Re: cannot acees two databases as owner
    ... it does not matter you are a member of the ... the sysadmin fixed server role or if there is no any other Login which is ... group if it's a domain) and you can login to your SQL Server with, ...
    (microsoft.public.sqlserver.setup)