Code to add domain user account and password to SQL 2005 server

  • Hello,

    Can someone provide me VBScript code or any website link to add a domain user acct and password to SQL 2005 server and run the service started with that domain user account

  • Not sure I understand. If you are adding a domain account there is not PW to add, as a domain account PW is not stored in SQL Server.

    Are you saying you want to add an account to SQL Server using VBScript?

    What about the service, what does that have to do with this?

    Chris

    Learning something new on every visit to SSC. Hoping to pass it on to someone else.

  • Chandu,

    Ditto on the password comment of the previous poster. As far as adding a user to the server via VB, all you have to do is use VB to run a stored procedure from SQL Server.

    Check out the following topics in SQL Server BOL for the stored procs you can run:

    Create Login statement

    Create User statement

    Then use VB to run those procs. Of course, whomever or whatever runs the VB script will need SecurityAdmin permissions on the Server. Without those, trying to run these procs in SQL will be like spitting into the wind. Kinda useless. @=)

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • Yes, i want to add the domain user account to SQL server as part of a post installation process. VBScript code should prompt for a UserID and Pwd using a msg box. The script should change the Log on account for each service to these credentials. Currently, the services run with NT AUTHORITY/LocalSystem account. Pleeease send me a code snippet.

  • Chandu,

    SQL Server does not take passwords for domain accounts. So don't write your code that way.

    If you're automating the install of SQL Server itself, then what you're trying won't work. If you're just automating the install of a third party, see my previous posts about calling SQL Server stored procedures via VB.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply