ReplicationServer.ChangeDistributorPassword Methode

Definition

Ändert das Verteilerkennwort.

Überlädt

ChangeDistributorPassword(SecureString)

Ändert das Verteilerkennwort, wobei das neue Kennwort als SecureString-Objekt angegeben wird.

ChangeDistributorPassword(String)

Ändert das Verteilerkennwort.

ChangeDistributorPassword(SecureString)

Ändert das Verteilerkennwort, wobei das neue Kennwort als SecureString-Objekt angegeben wird.

public:
 void ChangeDistributorPassword(System::Security::SecureString ^ password);
public void ChangeDistributorPassword (System.Security.SecureString password);
member this.ChangeDistributorPassword : System.Security.SecureString -> unit
Public Sub ChangeDistributorPassword (password As SecureString)

Parameter

password
SecureString

Das neue Verteilerkennwort ist ein SecureString-Wert.

Sicherheitshinweis: Fordern Sie Benutzer nach Möglichkeit zur Eingabe von Sicherheitsanmeldeinformationen zur Laufzeit auf. Wenn Sie Anmeldeinformationen speichern müssen, verwenden Sie die http://go.microsoft.com/fwlink/?LinkId=34733 kryptografischen Dienste, die vom Windows-.NET Framework bereitgestellt werden.

Hinweise

Die DistributorInstalled -Eigenschaft muss sein true , um diese Eigenschaft festzulegen.

Die ChangeDistributorPassword(SecureString) -Methode bietet zusätzliche Sicherheit für das Kennwort, während es im Arbeitsspeicher gespeichert ist und anstelle von ChangeDistributorPassword(String)verwendet werden sollte.

Die ChangeDistributorPassword -Methode kann von Mitgliedern der festen Serverrolle sysadmin am Verteiler aufgerufen werden.

Die ChangeDistributorPassword -Methode entspricht der gespeicherten sp_changedistributor_password -Prozedur (Transact-SQL).

Gilt für:

ChangeDistributorPassword(String)

Ändert das Verteilerkennwort.

public:
 void ChangeDistributorPassword(System::String ^ password);
public void ChangeDistributorPassword (string password);
member this.ChangeDistributorPassword : string -> unit
Public Sub ChangeDistributorPassword (password As String)

Parameter

password
String

Die neue Kennwortzeichenfolge für die distributor_admin-Anmeldung.

Sicherheitshinweis: Fordern Sie Benutzer nach Möglichkeit zur Eingabe von Sicherheitsanmeldeinformationen zur Laufzeit auf. Wenn Sie Anmeldeinformationen speichern müssen, verwenden Sie die http://go.microsoft.com/fwlink/?LinkId=34733 kryptografischen Dienste, die vom Windows-.NET Framework bereitgestellt werden.

Beispiele

// Set the Distributor and distribution database names.
string distributionDbName = "distribution";
string distributorName = publisherInstance;

ReplicationServer distributor;
DistributionDatabase distributionDb;

// Create a connection to the Distributor using Windows Authentication.
ServerConnection conn = new ServerConnection(distributorName);

try
{
    // Open the connection. 
    conn.Connect();

    distributor = new ReplicationServer(conn);

    // Load Distributor properties, if it is installed.
    if (distributor.LoadProperties())
    {
        // Password supplied at runtime.
        distributor.ChangeDistributorPassword(password);
        distributor.AgentCheckupInterval = 5;

        // Save changes to the Distributor properties.
        distributor.CommitPropertyChanges();
    }
    else
    {
        throw new ApplicationException(
            String.Format("{0} is not a Distributor.", publisherInstance));
    }

    // Create an object for the distribution database 
    // using the open Distributor connection.
    distributionDb = new DistributionDatabase(distributionDbName, conn);

    // Change distribution database properties.
    if (distributionDb.LoadProperties())
    {
        // Change maximum retention period to 48 hours and history retention 
        // period to 24 hours.
        distributionDb.MaxDistributionRetention = 48;
        distributionDb.HistoryRetention = 24;

        // Save changes to the distribution database properties.
        distributionDb.CommitPropertyChanges();
    }
    else
    {
        // Do something here if the distribution database does not exist.
    }
}
catch (Exception ex)
{
    // Implement the appropriate error handling here. 
    throw new ApplicationException("An error occured when changing Distributor " +
        " or distribution database properties.", ex);
}
finally
{
    conn.Disconnect();
}

Hinweise

Die DistributorInstalled -Eigenschaft muss sein true , um diese Eigenschaft festzulegen.

Die ChangeDistributorPassword -Methode kann von Mitgliedern der festen Serverrolle sysadmin am Verteiler aufgerufen werden.

Die ChangeDistributorPassword -Methode entspricht der gespeicherten sp_changedistributor_password -Prozedur (Transact-SQL).

Weitere Informationen

Gilt für: