Share via


ServiceInstanceId 屬性

取得可唯一識別服務此 SQL Server 執行個體之服務執行個體的識別碼值。

命名空間:  Microsoft.SqlServer.Management.Smo
組件:  Microsoft.SqlServer.Smo (在 Microsoft.SqlServer.Smo.dll 中)

語法

'宣告
<SfcPropertyAttribute(SfcPropertyFlags.Standalone)> _
Public ReadOnly Property ServiceInstanceId As String
    Get
'用途
Dim instance As Server
Dim value As String

value = instance.ServiceInstanceId
[SfcPropertyAttribute(SfcPropertyFlags.Standalone)]
public string ServiceInstanceId { get; }
[SfcPropertyAttribute(SfcPropertyFlags::Standalone)]
public:
property String^ ServiceInstanceId {
    String^ get ();
}
[<SfcPropertyAttribute(SfcPropertyFlags.Standalone)>]
member ServiceInstanceId : string
function get ServiceInstanceId () : String

屬性值

型別:System. . :: . .String
In32 值,指定 SQL Server 執行個體的執行個體識別碼值。

範例

C#

Server srv = new Server("(local)");
Console.WriteLine("The service instance ID is: " + srv.ServiceInstanceId);

PowerShell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
Write-Host "The service instance ID is:" $srv.ServiceInstanceId

請參閱

參考

Planning a SQL Server Installation

其他資源