Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

SQL Server runs under AD Account SQLAccount1. How to make it run under another account, SQLAccount2? How to do it un Powershell?

share|improve this question
up vote 0 down vote accepted
  1. The GUI way to do this is to go to SQL Server Configuration Manager. Go to the properties of the SQL Server and change the account name on the Log On tab. Click the Browse button.

enter image description here

Than enter the account that you want to SQL Server Log on as. Click Check Names, to make sure the account exists. Than click OK on select user or group and OK on SQL Server Properties.

enter image description here

Than restart.

2.This blog Hey, Scripting Guy! Blog, the author Aaron Nelson - SQLvariant shows how to do this in PowerShell.

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SqlWmiManagement") | out-null

$SMOWmiserver = New-Object ('Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer') "WIN7NetBook" #Suck in the server you want

#These just act as some queries about the SQL Services on the machine you specified.
$SMOWmiserver.Services | select name, type, ServiceAccount, DisplayName, Properties, StartMode, StartupParameters | Format-Table

#Same information just pivot the data
$SMOWmiserver.Services | select name, type, ServiceAccount, DisplayName, Properties, StartMode, StartupParameters | Format-List

#Specify the "Name" (from the query above) of the one service whose Service Account you want to change.

$ChangeService=$SMOWmiserver.Services | where {$ -eq "MSSQLSERVER"} #Make sure this is what you want changed!

#Check which service you have loaded first




$ChangeService.SetServiceAccount($UName, $PWord)

#Now take a look at it afterwards

share|improve this answer
That blog post was actually written by guest blogger, Aaron Nelson ( – Shawn Melton Aug 5 '12 at 2:17
Thank you, I'll correct it. – benRollag Aug 5 '12 at 2:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.