ServerConnection.ProcessID Property

Gets the ID value that uniquely identifies the process associated with the referenced connection to the server.

Namespace:  Microsoft.SqlServer.Management.Common
Assembly:  Microsoft.SqlServer.ConnectionInfo (in Microsoft.SqlServer.ConnectionInfo.dll)

public int ProcessID { get; }

Property Value

Type: System.Int32
An Int32 value that specifies the ID value that uniquely identifies the process associated with the referenced connection to the server.

C#

ServerConnection conn = new ServerConnection();
Console.WriteLine(conn.ProcessID);

PowerShell

$conn = new-object Microsoft.SqlServer.Management.Common.ServerConnection
Write-Host $conn.ProcessID

Community Additions

ADD
Show: