Skip to content

Latest commit

 

History

History
65 lines (51 loc) · 2.55 KB

File metadata and controls

65 lines (51 loc) · 2.55 KB
title SetServiceAccount Method (SqlService Class) | Microsoft Docs
ms.custom
ms.date 03/03/2017
ms.prod sql-non-specified
ms.prod_service database-engine
ms.service
ms.component wmi
ms.reviewer
ms.suite sql
ms.technology
database-engine
ms.tgt_pltfrm
ms.topic reference
apiname
SetServiceAccount Method (SqlService Class)
apilocation
sqlmgmproviderxpsp2up.mof
apitype MOFDef
helpviewer_keywords
SetServiceAccount method
ms.assetid d5782892-e9d8-4d48-92af-b3afe9610f84
caps.latest.revision 36
author JennieHubbard
ms.author jhubbard
manager jhubbard
ms.workload Inactive

SetServiceAccount Method (SqlService Class)

[!INCLUDEtsql-appliesto-ss2008-xxxx-xxxx-xxx-md] Attempts to change the user name and password that the service instance runs under.

Syntax

  
object.SetServiceAccount(ServiceStartName , ServiceStartPassword)  

Parts

object
A SqlService Class object that represents the service.

Parameters

ServiceStartName
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.

ServiceStartPassword
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.

Property Value/Return Value

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.

Remarks

See Also

Starting and Stopping Services