Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

SetServiceAccount Method (SqlService Class)


Applies To: SQL Server 2016 Preview

Attempts to change the user name and password that the service instance runs under.

object.SetServiceAccount(ServiceStartName , ServiceStartPassword)


A SqlService Class object that represents the service.


A string value that specifies the account name that the service runs under. Depending on the service type, the account name might be in the form of DomainName\Username. When it runs, the service process will be logged using one of two forms:

  • If the account belongs to the built-in domain, \Username can be specified.

  • If NULL is specified, the service will be logged on as the LocalSystem account.

For kernel or system-level drivers, StartName contains the driver object name, either \FileSystem\Rdr or \Driver\Xns, which the I/O system uses to load the device driver. If NULL is specified, the driver runs with a default object name created by the I/O system based on the service name, for example, DWDOM\Admin.


A string value that specifies the password for the account name in the StartName parameter. Specify NULL if you are not changing the password. Specify an empty string if the service has no password.

A uint32 value, which is 0 if the service was successfully modified or 1 if the request is not supported. Any other number indicates an error.

Community Additions

© 2015 Microsoft