How to change SQL Server Service log on account using cmd command or powershell?

more ▼

asked Jun 14, 2011 at 10:54 PM in Default

avatar image

1.4k 90 93 96

(comments are locked)
10|1200 characters needed characters left

4 answers: sort voted first

I got this for Powershell from Scripting Guy.

more ▼

answered Jun 14, 2011 at 11:14 PM

avatar image

10.8k 37 57 51

Thanks for your respond but I need to change this across 3000 different servers and these all are on different SQL version even I am not sure that Power shell is available on server. Is there any other way through this I can do it by window cmd command using cmdshell.

Jun 15, 2011 at 01:47 AM Sharma
(comments are locked)
10|1200 characters needed characters left

Before you go too far down this path I would strongly suggest looking at this Microsoft article for guidance on the ramifications of doing it and the related changes required.

If you are going to try via a CMD script you may want to investigate using the SC command with the config option.

SC config [service name] obj= [account] password= [password]

more ▼

answered Jun 15, 2011 at 06:24 AM

avatar image

12.1k 30 36 42

Yes, you would think that SSCM uses WMI in the background to show you SQL Server configuration information and applying changes you make so if I just go straight to WMI through PowerShell instead of the GUI would it do the same? I have not tested this but it is something to keep in mind.

Jun 15, 2011 at 06:34 AM Shawn_Melton

@meltondba - there are a lot more changes being made then just the account in the Services applet. There are group memberships, NTFS permissions, Registry permissions,... A lot of stuff is involved for a seemingly simple change.

Jun 15, 2011 at 06:37 AM Blackhawk-17

Thanks, It is really useful to check read article for change the service log on account, I know that we can change log on account through SQL Server configuration Manager but how we can change it through SQL Server Enterprise Manager.

Jun 15, 2011 at 09:50 PM Sharma

(1) Is all given below option required to change separately in memberships, NTFS permissions, Registry Permission etc. (Change MS SQL Service Log On account)

(a) WMI. (b) Window CMD sc command.( SC config [service name] obj= [account] password= [password]) (c) Powershell. (d) VB scripts.

(2) Is all above option available across all SQL Versions.

(3) Is all above four option installed with SQL Server.

Jun 15, 2011 at 10:08 PM Sharma

Due to the complexity of the behind-the-scenes-tech all the changes are required.

Jun 16, 2011 at 05:57 AM Blackhawk-17
(comments are locked)
10|1200 characters needed characters left

There is some VBScript that you could use.

Link here

more ▼

answered Jun 15, 2011 at 05:15 AM

avatar image

10.9k 27 37 37

(comments are locked)
10|1200 characters needed characters left

To change the service account in SQL Enterprise Manager:
Open Enterprise Manager
Drill down Microsoft SQL Servers > SQL Server Group
Right-Click on your instance > Select Properties
Under the Security Tab you should have a "Startup Service Account"
Set your username and password.
I believe it will prompt you to restart.

In doing it I can say it should set all the OS level permissions that it needs, but it would not hurt to take the KB article @Blackhawk-17 provided to just verify the settings are correct.

FYI: If you had provided the version of SQL Server you were running an answer would have come to you much quicker. Just saying :)

more ▼

answered Jun 16, 2011 at 11:18 AM

avatar image

6.6k 21 26 34

Hard to script the GUI :)

Jun 16, 2011 at 12:13 PM Blackhawk-17

OH...yeah forgot that part of the OP...oops

Jun 16, 2011 at 12:14 PM Shawn_Melton

Thanks but mine requirement to change SQL Server Log on account across 3000 Servers and these all are on different-2 versions. So I want to do this through application upgrade by cmd command using cmdshell.

Jun 16, 2011 at 10:01 PM Sharma
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Jun 14, 2011 at 10:54 PM

Seen: 2016 times

Last Updated: Jun 14, 2011 at 10:54 PM

Copyright 2018 Redgate Software. Privacy Policy