Every now and the question comes up how to programmatically modify the service account or password of SQL Server. There basically two ways to accomplish this, using SMO, or WMI. This article shows you how to use WMI and VBScript to accomplish this task.
There are a couple of things you need to know.
The following scripts allow you to change the service account + password, or only the password:
‘ Set the account and password
set svr = GetObject("WINMGMTS:\\.\root\Microsoft\SqlServer\ComputerManagement:SqlService.ServiceName='MSSQL$YUKON',SQLServiceType=1")
svr.SetServiceAccount ".\TestUser", "NewPassword!!"
‘ Set the password
svr.SetServiceAccountPassword "", "NewPassword2!!"
You need to change 'MSSQL$YUKON' to match your instance name (replace ‘YUKON’ with the instance name, or the entire string with MSSQLSERVER for the default instance). Of course the account and password need to be changed as well.
Try this on a test server first before running this on a production server.
I hope this is helpful,