Example #1
0
 protected override void BeginProcessing()
 {
     // TODO: Debug output
     // TODO: Exception handling
     //this.WriteDebug("Opening the Active Directory database.");
     NetworkCredential netCredential = null;
     if(this.Credential != null)
     {
         // Convert PSCredential to NetworkCredential
         netCredential = this.Credential.GetNetworkCredential();
     }
     this.ReplicationClient = new DirectoryReplicationClient(this.Server, this.Protocol, netCredential);
     //try
     //{
     //}
     //catch(SessionStateException ex)
     //{
     //    // This may be DriveNotFoundException, ItemNotFoundException, ProviderNotFoundException, etc.
     //    // Terminate on this error:
     //    this.ThrowTerminatingError(new ErrorRecord(ex.ErrorRecord, ex));
     //}
     //catch (Exception ex)
     //{
     //    ErrorRecord error = new ErrorRecord(ex, "DBContextError", ErrorCategory.OpenError, null);
     //    // Terminate on this error:
     //    this.ThrowTerminatingError(error);
     //}
 }
Example #2
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing && this.ReplicationClient != null)
     {
         this.ReplicationClient.Dispose();
         this.ReplicationClient = null;
     }
 }