Service.SetServiceAccount 方法

Sets the account under which the SQL Server service runs.

命名空间:  Microsoft.SqlServer.Management.Smo.Wmi
程序集:  Microsoft.SqlServer.SqlWmiManagement(在 Microsoft.SqlServer.SqlWmiManagement.dll 中)

语法

声明
Public Sub SetServiceAccount ( _
    userName As String, _
    password As String _
)
用法
Dim instance As Service 
Dim userName As String 
Dim password As String

instance.SetServiceAccount(userName, _
    password)
public void SetServiceAccount(
    string userName,
    string password
)
public:
void SetServiceAccount(
    String^ userName, 
    String^ password
)
member SetServiceAccount : 
        userName:string * 
        password:string -> unit
public function SetServiceAccount(
    userName : String, 
    password : String
)

参数

  • userName
    类型:System.String
    A String value that specifies the system account under which the SQL Server service runs.
  • password
    类型:System.String
    A String value that specifies the password for the system account.

示例

使用 WMI 提供程序管理服务和网络设置

请参阅

参考

Service 类

Microsoft.SqlServer.Management.Smo.Wmi 命名空间

其他资源

WMI and SQL Server

连接到 SQL Server 数据库引擎