Compartir a través de


RegisteredServer Object

Esta característica se quitará en una versión futura de Microsoft SQL Server. Evite utilizar esta característica en nuevos trabajos de desarrollo y tenga previsto modificar las aplicaciones que actualmente la utilizan.

The RegisteredServer object exposes the attributes of a single, registry-listed instance of Microsoft SQL Server.

Modelo de objeto SQL-DMO con el objeto actual

Properties

Login Property

SaLogin Property

Name Property

UseTrustedConnection Property

Password Property

VersionMajor Property

PersistFlags Property

VersionMinor Property

Methods

Remove Method (Objects)

Notas

SQL Distributed Management Objects (SQL-DMO) applications can maintain lists of some or all instances of SQL Server in an organization in the registry of the operating system. The lists establish categories for instances of SQL Server.

For example, to group and view servers by division in a SQL-DMO application, SQL-DMO would represent each division as a ServerGroup object. The division's ServerGroup name is maintained by SQL-DMO as a Windows registry key. Within this registry entry, separate keys list each instance of SQL Server in the division. The list of these keys forms the members of the SQL-DMO RegisteredServers collection, while each key's data is exposed by a RegisteredServer object.

With the RegisteredServer object, you can:

  • Create a Windows registry entry that lists an organization server.
  • Remove a Windows registry entry that lists an instance of SQL Server.
  • Manage a Windows registry entry that lists an instance of SQL Server by setting connection-validation attributes.

The Name property of the RegisteredServer object refers to the instance of SQL Server registered. SQL-DMO does not attempt to validate the Name property value when registering an instance of SQL Server. The RegisteredServer object Name property is validated when the object is used in an attempt to connect to an instance of SQL Server.

After an instance of SQL Server is registered, SQL-DMO uses the properties of the registered server when connecting and when attempting to reconnect after a connection failure. For example, SQL-DMO ignores the szLogin and szPassword parameters of the Connect method of the SQLServer object when that object references an instance of SQL Server registered to use Windows Authentication Mode.

To create a registry entry listing an instance of SQL Server

  1. Create a RegisteredServer object.

  2. Set the properties determining connection validation appropriately. For example, set the UseTrustedConnection property to TRUE to enable Windows Authentication Mode.

  3. Add the RegisteredServer object to the RegisteredServers collection of the ServerGroup object of an Application object.