Server.ServiceAccount Server.ServiceAccount Server.ServiceAccount Property

Definition

Gets the service account under which the instance of SQL Server is running.

public:
 property System::String ^ ServiceAccount { System::String ^ get(); };
[Microsoft.SqlServer.Management.Sdk.Sfc.Metadata.SfcProperty(Microsoft.SqlServer.Management.Sdk.Sfc.Metadata.SfcPropertyFlags.Standalone)]
public string ServiceAccount { get; }
Public ReadOnly Property ServiceAccount As String
Property Value

A String value that specifies service account for the instance of SQL Server.

Examples

C#

Server srv = new Server("(local)");  
Console.WriteLine("The SQL Server service account is:" + srv.ServiceAccount);  

PowerShell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")  
Write-Host "The SQL Server service account is:" $srv.ServiceAccount  

Applies to

See Also