共用方式為


Server.ActiveDirectory 屬性

注意:此 API 已經過時。

Gets information about the Active Directory settings for the instance of SQL Server.

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

語法

'宣告
<SfcObjectAttribute(SfcObjectRelationship.Object, SfcObjectCardinality.One)> _
<ObsoleteAttribute> _
Public ReadOnly Property ActiveDirectory As ServerActiveDirectory 
    Get
'用途
Dim instance As Server 
Dim value As ServerActiveDirectory 

value = instance.ActiveDirectory
[SfcObjectAttribute(SfcObjectRelationship.Object, SfcObjectCardinality.One)]
[ObsoleteAttribute]
public ServerActiveDirectory ActiveDirectory { get; }
[SfcObjectAttribute(SfcObjectRelationship::Object, SfcObjectCardinality::One)]
[ObsoleteAttribute]
public:
property ServerActiveDirectory^ ActiveDirectory {
    ServerActiveDirectory^ get ();
}
[<SfcObjectAttribute(SfcObjectRelationship.Object, SfcObjectCardinality.One)>]
[<ObsoleteAttribute>]
member ActiveDirectory : ServerActiveDirectory
function get ActiveDirectory () : ServerActiveDirectory

屬性值

型別:Microsoft.SqlServer.Management.Smo.ServerActiveDirectory
A ServerActiveDirectory object that specifies the Active Directory settings for the database.

備註

The ActiveDirectory property points to a ServerActiveDirectory object, which can be used to register the instance of SQL Server in Active Directory.

When you call the Register method to add an instance of SQL Server to Active Directory, users can use Active Directory to find this instance of SQL Server. This is useful in large organizations with many instances of SQL Server.

範例

Visual Basic

'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server
'Register the instance of SQL Server in the Active Directory directory service.
srv.ActiveDirectory.Register()

PowerShell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server
$srv.ActiveDirectory.Register()

請參閱

參考

Server 類別

Microsoft.SqlServer.Management.Smo 命名空間

其他資源

連接到 SQL Server 的執行個體

從 SQL Server 的執行個體中斷連接

管理伺服器