protected override void InternalValidate() { base.InternalValidate(); if (!this.Identity.IsUnique()) { base.WriteError(new NonUniqueEventCategoryInputException(), ErrorCategory.InvalidData, this.Identity); } ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(null, true, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 148, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\EventLog\\SetEventLogLevel.cs"); EventCategoryIdentity eventCategoryIdentity = null; if (this.Identity.ToString() != null) { eventCategoryIdentity = EventCategoryIdentity.Parse(this.Identity.ToString()); } Server obj; if (eventCategoryIdentity == null || string.IsNullOrEmpty(eventCategoryIdentity.Server)) { obj = topologyConfigurationSession.FindLocalServer(); } else { ServerIdParameter serverIdParameter = ServerIdParameter.Parse(eventCategoryIdentity.Server); obj = (Server)base.GetDataObject <Server>(serverIdParameter, topologyConfigurationSession, null, null, new LocalizedString?(Strings.ErrorServerNotUnique(serverIdParameter.ToString())), new LocalizedString?(Strings.ErrorServerNotFound(serverIdParameter.ToString()))); } ADSessionSettings sessionSettings = ADSessionSettings.FromCustomScopeSet(base.ScopeSet, ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest(), base.CurrentOrganizationId, base.ExecutingUserOrganizationId, true); MapiTaskHelper.VerifyIsWithinConfigWriteScope(sessionSettings, obj, new Task.ErrorLoggerDelegate(base.ThrowTerminatingError)); }
protected string DiscoverServerToQuery(ServerIdParameter serverToContactParam, DatabaseAvailabilityGroup dag) { string fqdn; if (serverToContactParam == null) { AmServerName primaryActiveManager = this.GetPrimaryActiveManager(dag); fqdn = primaryActiveManager.Fqdn; } else { Server server = this.LookupServer(serverToContactParam); ADObjectId databaseAvailabilityGroup = server.DatabaseAvailabilityGroup; if (databaseAvailabilityGroup == null) { base.WriteError(new ServerMustBeInDagException(server.Fqdn), ErrorCategory.InvalidData, serverToContactParam); return(null); } if (!databaseAvailabilityGroup.Equals(dag.Id)) { base.WriteError(new ServerToContactMustBeInSameDagException(server.Name, dag.Name, databaseAvailabilityGroup.Name), ErrorCategory.InvalidData, serverToContactParam); return(null); } fqdn = server.Fqdn; } return(fqdn); }
internal static Server ResolveExpansionServer(string expansionServer, ITopologyConfigurationSession scSession, DataAccessHelper.CategorizedGetDataObjectDelegate getUniqueDataObjectDelegate, Task.ErrorLoggerDelegate errorHandler) { if (string.IsNullOrEmpty(expansionServer)) { throw new ArgumentNullException("expansionServer"); } if (scSession == null) { throw new ArgumentNullException("scSession"); } if (getUniqueDataObjectDelegate == null) { throw new ArgumentNullException("getUniqueDataObjectDelegate"); } if (errorHandler == null) { throw new ArgumentNullException("errorHandler"); } ServerIdParameter id = null; try { id = ServerIdParameter.Parse(expansionServer); } catch (ArgumentException) { errorHandler(new TaskArgumentException(Strings.ErrorInvalidExpansionServer(expansionServer)), ExchangeErrorCategory.Client, null); } return((Server)getUniqueDataObjectDelegate(id, scSession, null, null, new LocalizedString?(Strings.ErrorServerNotFound(expansionServer)), new LocalizedString?(Strings.ErrorServerNotUnique(expansionServer)), ExchangeErrorCategory.Client)); }
internal override void InitializeInnerFilter <Object>(QueueViewerPropertyDefinition <Object> messageIdentity, QueueViewerPropertyDefinition <Object> queueIdentity) { if (this.Identity != null) { if (this.Identity.IsFullySpecified) { this.innerFilter = new ComparisonFilter(ComparisonOperator.Equal, messageIdentity, this.Identity); } else { this.innerFilter = new TextFilter(messageIdentity, this.Identity.ToString(), MatchOptions.FullString, MatchFlags.Default); } base.Server = ServerIdParameter.Parse(this.Identity.QueueIdentity.Server); return; } if (this.Queue != null) { if (this.Queue.IsFullySpecified) { this.innerFilter = new ComparisonFilter(ComparisonOperator.Equal, queueIdentity, this.Queue); } else { this.innerFilter = new TextFilter(queueIdentity, this.Queue.ToString(), MatchOptions.FullString, MatchFlags.Default); } base.Server = ServerIdParameter.Parse(this.Queue.Server); } }
protected override void WriteResult(IConfigurable dataObject) { TaskLogger.LogEnter(new object[] { dataObject.Identity, dataObject }); try { Database database = (Database)dataObject; if (database.IsExchange2009OrLater || (this.AllowLegacy && (ServerIdParameter.HasRole(((Database)dataObject).Server, ServerRole.Mailbox, base.DataSession) || !ServerIdParameter.HasRole(((Database)dataObject).Server, ServerRole.All, base.DataSession)))) { string text; if (this.serverLegacyDNToFqdnCache.TryGetValue(database.RpcClientAccessServerLegacyDN, out text)) { database.RpcClientAccessServer = text; } database.CompleteAllCalculatedProperties(); if (text == null) { this.serverLegacyDNToFqdnCache.Add(database.RpcClientAccessServerLegacyDN, database.RpcClientAccessServer); } base.WriteResult(dataObject); } } catch (InvalidOperationException) { base.WriteError(new InvalidADObjectOperationException(Strings.ErrorFoundInvalidADObject(((ADObjectId)dataObject.Identity).ToDNString())), ErrorCategory.InvalidOperation, this.Identity); } TaskLogger.LogExit(); }
protected override void InternalValidate() { base.InternalValidate(); if (base.HasErrors) { return; } if (this.Identity != null) { this.Server = ServerIdParameter.Parse(this.Identity.Server); } if (this.Server == null || string.Compare(this.Server.ToString(), "localhost", true) == 0) { this.Server = new ServerIdParameter(); } IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(base.CurrentOrganizationId), 263, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\transport\\Queueviewer\\QueueTasks.cs"); ServerIdParameter server = this.Server; Server entry = (Server)this.GetDataObject <Server>(server, tenantOrTopologyConfigurationSession, null, null, Strings.ErrorServerNotFound(server.ToString()), Strings.ErrorServerNotUnique(server.ToString())); ADScopeException ex; if (!tenantOrTopologyConfigurationSession.TryVerifyIsWithinScopes(entry, true, out ex)) { base.WriteError(new TaskInvalidOperationException(Strings.ErrorCannotChangeObjectOutOfWriteScope((this.Identity != null) ? this.Identity.ToString() : this.Server.ToString(), (ex == null) ? string.Empty : ex.Message), ex), ExchangeErrorCategory.Context, this.Identity); } if (this.Filter != null && !VersionedQueueViewerClient.UsePropertyBagBasedAPI((string)this.Server)) { this.InitializeInnerFilter <QueueInfoSchema>(this.Filter, ObjectSchema.GetInstance <QueueInfoSchema>()); } }
protected override void WriteResult(IConfigurable dataObject) { TaskLogger.LogEnter(new object[] { dataObject.Identity, dataObject }); try { if (ServerIdParameter.HasRole((ADObjectId)dataObject.Identity, ServerRole.Cafe | ServerRole.Mailbox | ServerRole.ClientAccess | ServerRole.UnifiedMessaging | ServerRole.HubTransport | ServerRole.FrontendTransport | ServerRole.FfoWebService | ServerRole.OSP, base.DataSession)) { ADVirtualDirectory advirtualDirectory = dataObject as ADVirtualDirectory; if (advirtualDirectory != null) { advirtualDirectory.AdminDisplayVersion = Microsoft.Exchange.Data.Directory.SystemConfiguration.Server.GetServerVersion(advirtualDirectory.Server.Name); } base.WriteResult(dataObject); } } catch (InvalidOperationException) { base.WriteError(new InvalidADObjectOperationException(Strings.ErrorFoundInvalidADObject(((ADObjectId)dataObject.Identity).ToDNString())), ErrorCategory.InvalidOperation, this.Identity); } TaskLogger.LogExit(); }
protected override void InternalValidate() { base.InternalValidate(); if (base.HasErrors) { return; } if (this.Identity != null) { this.Server = ServerIdParameter.Parse(this.Identity.QueueIdentity.Server); } }
protected override void InternalValidate() { TaskLogger.LogEnter(); ServerIdParameter serverIdParameter = new ServerIdParameter(); this.Server = (Server)base.GetDataObject <Server>(serverIdParameter, base.DataSession, null, new LocalizedString?(Strings.ErrorServerNotFound(serverIdParameter.ToString())), new LocalizedString?(Strings.ErrorServerNotUnique(serverIdParameter.ToString()))); if (!this.ShouldUpdateVirtualDirectory()) { base.WriteError(this.Server.GetServerRoleError(ServerRole.Mailbox | ServerRole.ClientAccess | ServerRole.UnifiedMessaging | ServerRole.HubTransport), ErrorCategory.InvalidOperation, this.Server); } base.InternalValidate(); TaskLogger.LogExit(); }
protected override IConfigurable PrepareDataObject() { ADGroup adgroup = null; this.configSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(base.DomainController, false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 197, "PrepareDataObject", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\RecipientTasks\\permission\\DelegateBaseTask.cs"); if (this.Role == DelegateRoleType.ServerAdmin) { ServerIdParameter serverIdParameter = null; try { serverIdParameter = ServerIdParameter.Parse(this.Scope); } catch (ArgumentException exception) { base.WriteError(exception, ErrorCategory.InvalidData, null); } this.server = (Server)base.GetDataObject <Server>(serverIdParameter, this.configSession, null, new LocalizedString?(Strings.ErrorServerNotFound((string)serverIdParameter)), new LocalizedString?(Strings.ErrorServerNotUnique((string)serverIdParameter))); } IRecipientSession recipientSession = (IRecipientSession)base.DataSession; bool useGlobalCatalog = recipientSession.UseGlobalCatalog; recipientSession.UseGlobalCatalog = true; try { if (this.Role == DelegateRoleType.OrgAdmin) { adgroup = ((IDirectorySession)base.DataSession).ResolveWellKnownGuid <ADGroup>(WellKnownGuid.EoaWkGuid, this.ConfigurationSession.ConfigurationNamingContext.ToDNString()); } else if (this.Role == DelegateRoleType.RecipientAdmin) { adgroup = ((IDirectorySession)base.DataSession).ResolveWellKnownGuid <ADGroup>(WellKnownGuid.EmaWkGuid, this.ConfigurationSession.ConfigurationNamingContext.ToDNString()); } else if (this.Role == DelegateRoleType.PublicFolderAdmin) { adgroup = ((IDirectorySession)base.DataSession).ResolveWellKnownGuid <ADGroup>(WellKnownGuid.EpaWkGuid, this.ConfigurationSession.ConfigurationNamingContext.ToDNString()); } else if (this.Role == DelegateRoleType.ViewOnlyAdmin || this.Role == DelegateRoleType.ServerAdmin) { adgroup = ((IDirectorySession)base.DataSession).ResolveWellKnownGuid <ADGroup>(WellKnownGuid.EraWkGuid, this.ConfigurationSession.ConfigurationNamingContext.ToDNString()); } } finally { recipientSession.UseGlobalCatalog = useGlobalCatalog; } if (adgroup == null) { base.WriteError(new InvalidOperationException(Strings.ErrorExchangeAdministratorsGroupNotFound(this.Role.ToString(), this.Identity.ToString())), ErrorCategory.InvalidData, this.Role); } return(adgroup); }
private void ResolveDatabaseAndServer() { ActiveManager activeManagerInstance = ActiveManager.GetActiveManagerInstance(); if (this.Server != null) { this.server = MapiTaskHelper.GetMailboxServer(this.Server, (ITopologyConfigurationSession)this.ConfigurationSession, new Task.ErrorLoggerDelegate(base.WriteError)); } else if (this.Identity != null) { DatabaseIdParameter identity = this.Identity; identity.AllowLegacy = false; Database database = (Database)base.GetDataObject <Database>(identity, this.ConfigurationSession, null, new LocalizedString?(Strings.ErrorDatabaseNotFound(identity.ToString())), new LocalizedString?(Strings.ErrorDatabaseNotUnique(identity.ToString()))); ServerIdParameter serverIdParameter; if (this.CopyOnServer != null) { serverIdParameter = this.CopyOnServer; } else { if (database.Server == null) { base.WriteError(new MdbAdminTaskException(Strings.ErrorInvalidObjectMissingCriticalProperty(typeof(Database).Name, identity.ToString(), DatabaseSchema.Server.Name)), ErrorCategory.InvalidArgument, database); } DatabaseLocationInfo serverForDatabase = activeManagerInstance.GetServerForDatabase(database.Guid); serverIdParameter = ServerIdParameter.Parse(serverForDatabase.ServerFqdn); } this.server = (Server)base.GetDataObject <Server>(serverIdParameter, this.ConfigurationSession, null, new LocalizedString?(Strings.ErrorServerNotFound(serverIdParameter.ToString())), new LocalizedString?(Strings.ErrorServerNotUnique(serverIdParameter.ToString()))); if (!this.server.IsExchange2007OrLater || !this.server.IsMailboxServer) { base.WriteError(new MdbAdminTaskException(Strings.ErrorLocalServerIsNotMailboxServer), ErrorCategory.InvalidArgument, this.server); } this.databases = new List <Database>(new Database[] { database }); } else { ServerIdParameter serverIdParameter2 = new ServerIdParameter(); this.server = (Server)base.GetDataObject <Server>(serverIdParameter2, this.ConfigurationSession, null, new LocalizedString?(Strings.ErrorLocalMachineIsNotExchangeServer), new LocalizedString?(Strings.ErrorServerNotUnique(serverIdParameter2.ToString()))); if (!this.server.IsExchange2007OrLater || !this.server.IsMailboxServer) { base.WriteError(new MdbAdminTaskException(Strings.ErrorLocalServerIsNotMailboxServer), ErrorCategory.InvalidArgument, this.server); } } if (this.databases.Count == 0) { this.databases = StoreCommon.PopulateDatabasesFromServer(activeManagerInstance, this.server, this.IncludePassive); } }
private ServerIdParameter AutoDiscoverTargetServer() { ServerIdParameter result = base.Task.Identity; ADPagedReader <Server> adpagedReader = base.Task.ConfigurationSession.FindAllPaged <Server>(); foreach (Server server in adpagedReader) { if (server.IsExchange2007OrLater && server.IsMailboxServer && (!string.Equals(server.Name, base.SourceMailboxServer.Name) || (server.ServerSite != null && base.SourceMailboxServer.ServerSite != null && !string.Equals(server.ServerSite.Name, base.SourceMailboxServer.ServerSite.Name, StringComparison.OrdinalIgnoreCase)))) { result = ServerIdParameter.Parse(server.Identity.ToString()); break; } } return(result); }
protected override void InternalValidate() { TaskLogger.LogEnter(); base.InternalValidate(); if (base.HasErrors) { TaskLogger.LogExit(); return; } if (this.Server == null) { this.Server = ServerIdParameter.Parse("localhost"); } this.ResolveTargetServer(); TaskLogger.LogExit(); }
protected override void InternalValidate() { base.InternalValidate(); if (base.HasErrors) { return; } if (base.Identity == null && this.Server == null) { this.Server = ServerIdParameter.Parse("localhost"); } if (this.Filter != null && !VersionedQueueViewerClient.UsePropertyBagBasedAPI((string)this.Server)) { this.InitializeInnerFilter <MessageInfoSchema>(this.Filter, ObjectSchema.GetInstance <MessageInfoSchema>()); } }
protected override IConfigurable PrepareDataObject() { TaskLogger.LogEnter(); Server server = (Server)base.PrepareDataObject(); if (!base.Fields.IsModified("SubmissionServerOverrideList") && server.IsModified(MailboxServerSchema.SubmissionServerOverrideLIst)) { foreach (ADObjectId adObjectId in server.SubmissionServerOverrideList.Added) { ServerIdParameter serverIdParameter = new ServerIdParameter(adObjectId); Server server2 = (Server)base.GetDataObject <Server>(serverIdParameter, this.ConfigurationSession, null, new LocalizedString?(Strings.ErrorServerNotFound(serverIdParameter.ToString())), new LocalizedString?(Strings.ErrorServerNotUnique(serverIdParameter.ToString()))); } } TaskLogger.LogExit(); return(server); }
private Server GetServer(ServerIdParameter server) { if (server == null) { throw new ArgumentNullException("server"); } IEnumerable <Server> objects = server.GetObjects <Server>(null, base.GlobalConfigSession); using (IEnumerator <Server> enumerator = objects.GetEnumerator()) { if (enumerator.MoveNext()) { return(enumerator.Current); } } throw new ServerNotFoundException("server not found", server.ToString()); }
protected Server LookupServer(ServerIdParameter serverParam) { ADObjectId id = new ServersContainer().Id; Server server = (Server)base.GetDataObject <Server>(serverParam, base.GlobalConfigSession, id, new LocalizedString?(Strings.ErrorMailboxServerNotFound(serverParam.ToString())), new LocalizedString?(Strings.ErrorMailboxServerNotUnique(serverParam.ToString()))); if (!server.IsMailboxServer) { base.WriteError(server.GetServerRoleError(ServerRole.Mailbox), ErrorCategory.InvalidOperation, serverParam); return(null); } if (!server.IsE14OrLater) { base.WriteError(new InvalidOperationException(Strings.ErrorServerNotE14OrLater(server.Name)), ErrorCategory.InvalidOperation, serverParam); return(null); } return(server); }
protected override void InternalValidate() { if (!ImportUMPrompt.IsDesktopExperienceRoleInstalled()) { ServerIdParameter serverIdParameter = new ServerIdParameter(); base.WriteError(new DesktopExperienceRequiredException(serverIdParameter.Fqdn), ErrorCategory.NotInstalled, null); } base.InternalValidate(); long num = (this.PromptFileData != null) ? ((long)this.PromptFileData.Length) : this.PromptFileStream.Length; if (num > 5242880L) { this.HandleOversizeAudioData(); } if (this.PromptFileName.Length > 128 || !string.Equals(Path.GetFileName(this.PromptFileName), this.PromptFileName)) { base.WriteError(new InvalidFileNameException(128), ErrorCategory.InvalidArgument, null); } }
private Server GetServerFromId(ServerIdParameter serverId) { Server server = (Server)base.Task.GetAdDataObject <Server>(serverId, base.Task.ConfigurationSession, null, new LocalizedString?(Strings.ErrorServerNotFound(serverId.ToString())), new LocalizedString?(Strings.ErrorServerNotUnique(serverId.ToString()))); LocalizedException ex = null; if (!server.IsExchange2007OrLater) { ex = new OperationOnOldServerException(server.Name); } else if (!server.IsMailboxServer) { ex = new OperationOnlyOnMailboxServerException(server.Name); } if (ex != null) { base.WriteErrorAndMonitoringEvent(ex, ErrorCategory.InvalidArgument, 1006); } return(server); }
internal override void InternalValidate() { base.InternalValidate(); base.IsRemoteTest = (!string.IsNullOrEmpty(base.Task.TargetEmailAddress) || base.Task.TargetMailboxServer != null || base.Task.TargetDatabase != null || base.Task.AutoDiscoverTargetMailboxServer.IsPresent); if (base.IsRemoteTest) { base.SetMonitoringDataSourceType("Remote"); } else { base.SetMonitoringDataSourceType("Local"); } if (base.Task.Identity == null) { string machineName = Environment.MachineName; base.Task.Identity = ServerIdParameter.Parse(machineName); } base.SourceMailboxServer = this.GetServerFromId(base.Task.Identity); try { base.SourceSystemMailboxMdb = base.GetServerMdb(base.SourceMailboxServer); base.SourceSystemMailbox = base.GetSystemMailboxFromMdb(base.SourceSystemMailboxMdb); this.sourceServerHasMdb = true; } catch (MailboxServerNotHostingMdbException) { this.sourceServerHasMdb = false; } if (this.sourceServerHasMdb) { this.friendlySourceAddress = base.Task.Identity.ToString() + "\\" + base.SourceSystemMailbox.PrimarySmtpAddress.ToString(); if (!base.IsRemoteTest) { this.targetMailboxAddress = base.SourceSystemMailbox.PrimarySmtpAddress.ToString(); this.friendlyTargetAddress = this.friendlySourceAddress; return; } this.SetTargetParameters(); } }
private void ResolveDatabaseAndServer() { DatabaseIdParameter database = this.Database; database.AllowLegacy = false; Database database2 = (Database)base.GetDataObject <Database>(database, this.ConfigurationSession, null, new LocalizedString?(Strings.ErrorDatabaseNotFound(database.ToString())), new LocalizedString?(Strings.ErrorDatabaseNotUnique(database.ToString()))); if (database2.Server == null) { base.WriteError(new MdbAdminTaskException(Strings.ErrorInvalidObjectMissingCriticalProperty(typeof(Database).Name, database.ToString(), DatabaseSchema.Server.Name)), ErrorCategory.InvalidArgument, database2); } ActiveManager activeManagerInstance = ActiveManager.GetActiveManagerInstance(); DatabaseLocationInfo serverForDatabase = activeManagerInstance.GetServerForDatabase(database2.Guid); ServerIdParameter serverIdParameter = ServerIdParameter.Parse(serverForDatabase.ServerFqdn); this.targetServer = (Server)base.GetDataObject <Server>(serverIdParameter, this.ConfigurationSession, null, new LocalizedString?(Strings.ErrorServerNotFound(serverIdParameter.ToString())), new LocalizedString?(Strings.ErrorServerNotUnique(serverIdParameter.ToString()))); if (!this.TargetServer.IsE14OrLater || !this.TargetServer.IsMailboxServer) { base.WriteError(new MdbAdminTaskException(Strings.ErrorLocalServerIsNotMailboxServer), ErrorCategory.InvalidArgument, this.TargetServer); } this.targetDatabase = database2; }
protected override void WriteResult(IConfigurable dataObject) { PublicFolderDatabase publicFolderDatabase = (PublicFolderDatabase)dataObject; if (!publicFolderDatabase.IsReadOnly) { Server server = publicFolderDatabase.GetServer(); if (server == null) { base.WriteError(new InvalidOperationException(Strings.ErrorDBOwningServerNotFound(publicFolderDatabase.Identity.ToString())), ErrorCategory.InvalidOperation, publicFolderDatabase.Identity); } publicFolderDatabase.UseCustomReferralServerList = server.UseCustomReferralServerList; foreach (ServerCostPair serverCostPair in server.CustomReferralServerList) { ServerIdParameter serverIdParameter = new ServerIdParameter(new ADObjectId(null, serverCostPair.ServerGuid)); IEnumerable <Server> objects = serverIdParameter.GetObjects <Server>(null, base.DataSession); IEnumerator <Server> enumerator2 = objects.GetEnumerator(); Server server2 = null; if (enumerator2.MoveNext()) { server2 = enumerator2.Current; if (enumerator2.MoveNext()) { server2 = null; } } if (server2 == null) { publicFolderDatabase.CustomReferralServerList.Add(serverCostPair); } else { publicFolderDatabase.CustomReferralServerList.Add(new ServerCostPair(server2.Guid, server2.Name, serverCostPair.Cost)); } } publicFolderDatabase.ResetChangeTracking(); } base.WriteResult(dataObject); }
protected override void InternalProcessRecord() { if (this.TenantId != null) { try { base.CurrentOrganizationId = GetDarTask.ResolveOrganizationId(this.TenantId); } catch (ArgumentException exception) { base.WriteError(exception, ErrorCategory.InvalidArgument, this.TenantId); return; } base.WriteObject(string.Format(Strings.ResolvedOrg, base.CurrentOrganizationId)); this.ExecutionUnit = GetDarTask.ResolveServerId(base.CurrentOrganizationId); base.WriteObject(string.Format(Strings.ResolvedServer, this.ExecutionUnit)); } try { using (HostRpcClient hostRpcClient = new HostRpcClient(this.ExecutionUnit.Fqdn)) { string darInfo = hostRpcClient.GetDarInfo(); if (!string.IsNullOrEmpty(darInfo)) { foreach (string sendToPipeline in darInfo.Split(new char[] { '\n' })) { base.WriteObject(sendToPipeline); } } } } catch (ServerUnavailableException exception2) { base.WriteError(exception2, ErrorCategory.ConnectionError, this.ExecutionUnit.Fqdn); } }
private void ValidateIncludeExclude() { QueueViewerIncludesAndExcludes exclude = this.Exclude; QueueViewerIncludesAndExcludes include = this.Include; if (exclude == null && include == null) { return; } if (this.Identity != null) { base.Server = ServerIdParameter.Parse(this.Identity.Server); } string filter; LocalizedString localizedString; if (QueueViewerIncludesAndExcludes.ComposeFilterString(base.Filter, exclude, include, out filter, out localizedString)) { base.Filter = filter; return; } base.WriteError(new LocalizedException(localizedString), ErrorCategory.InvalidData, base.Filter); }
protected override void InternalValidate() { try { if (this.Server == null) { this.Server = new ServerIdParameter(); } base.InternalValidate(); } catch (RpcException rpcException) { GetResubmitRequest.ProcessRpcError(rpcException, this.Server.Fqdn, this); } catch (ResubmitRequestException exception) { base.WriteError(exception, ErrorCategory.InvalidArgument, null); } catch (LocalizedException exception2) { base.WriteError(exception2, ExchangeErrorCategory.Client, null); } }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); base.InternalProcessRecord(); ServerIdParameter serverIdParameter = new ServerIdParameter(); Server server = (Server)base.GetDataObject <Server>(serverIdParameter, base.DataSession, null, new LocalizedString?(Strings.ErrorServerNotFound(serverIdParameter.ToString())), new LocalizedString?(Strings.ErrorServerNotUnique(serverIdParameter.ToString()))); if (!server.IsClientAccessServer && !server.IsCafeServer) { base.ThrowTerminatingError(server.GetServerRoleError(ServerRole.ClientAccess), ErrorCategory.InvalidOperation, server); } using (ServerManager serverManager = new ServerManager()) { ApplicationPool applicationPool = serverManager.ApplicationPools["MSExchangeOWAAppPool"]; if (applicationPool == null) { base.ThrowTerminatingError(new ADNoSuchObjectException(Strings.ErrorOWAVdirAppPoolNotExist), ErrorCategory.ObjectNotFound, serverManager.ApplicationPools); } applicationPool.ManagedPipelineMode = 0; serverManager.CommitChanges(); } QueryFilter filter = new ComparisonFilter(ComparisonOperator.NotEqual, ADOwaVirtualDirectorySchema.OwaVersion, OwaVersions.Exchange2003or2000); base.WriteVerbose(TaskVerboseStringHelper.GetFindDataObjectsVerboseString(base.DataSession, typeof(ADOwaVirtualDirectory), filter, server.Identity, true)); IConfigDataProvider dataSession = base.DataSession; IEnumerable <ADOwaVirtualDirectory> enumerable = dataSession.FindPaged <ADOwaVirtualDirectory>(filter, server.Identity, true, null, 0); foreach (ADOwaVirtualDirectory adowaVirtualDirectory in enumerable) { if (adowaVirtualDirectory.WebSite.Equals("Exchange Back End", StringComparison.OrdinalIgnoreCase)) { string metabasePath = adowaVirtualDirectory.MetabasePath; try { base.WriteVerbose(Strings.VerboseConnectingIISVDir(metabasePath)); using (IisUtility.CreateIISDirectoryEntry(metabasePath)) { if (!DirectoryEntry.Exists(metabasePath)) { this.WriteWarning(Strings.OwaAdOrphanFound(adowaVirtualDirectory.Identity.ToString())); continue; } if (!IisUtility.WebDirObjectExists(metabasePath, this.owaVersion)) { base.WriteVerbose(Strings.VerboseCreatingChildVDir(this.owaVersion, metabasePath)); CreateVirtualDirectory createVirtualDirectory = new CreateVirtualDirectory(); createVirtualDirectory.Name = this.owaVersion; createVirtualDirectory.Parent = metabasePath; createVirtualDirectory.CustomizedVDirProperties = OwaVirtualDirectoryHelper.GetVersionVDirProperties(); createVirtualDirectory.LocalPath = (string)IisUtility.GetIisPropertyValue("Path", createVirtualDirectory.CustomizedVDirProperties); createVirtualDirectory.Initialize(); createVirtualDirectory.Execute(); } } OwaVirtualDirectoryHelper.CreateLegacyVDirs(metabasePath, true); OwaVirtualDirectoryHelper.CreateOwaCalendarVDir(metabasePath, VirtualDirectoryRole.Mailbox); if (ExchangeServiceVDirHelper.IsBackEndVirtualDirectory(adowaVirtualDirectory)) { WebAppVirtualDirectoryHelper.UpdateMetabase(adowaVirtualDirectory, metabasePath, true); } } catch (COMException ex) { base.WriteError(new IISGeneralCOMException(ex.Message, ex.ErrorCode, ex), ErrorCategory.InvalidOperation, null); } if (adowaVirtualDirectory.ExchangeVersion.IsOlderThan(adowaVirtualDirectory.MaximumSupportedExchangeObjectVersion)) { try { adowaVirtualDirectory.SetExchangeVersion(adowaVirtualDirectory.MaximumSupportedExchangeObjectVersion); base.DataSession.Save(adowaVirtualDirectory); } catch (DataSourceTransientException exception) { base.WriteError(exception, ErrorCategory.WriteError, null); } } } } TaskLogger.LogExit(); }
internal CasTransactionOutcome(string clientAccessServer, string scenarioName, string scenarioDescription, string performanceCounterName, string localSite, bool secureAccess, string userName) : base((!string.IsNullOrEmpty(clientAccessServer)) ? ServerIdParameter.Parse(clientAccessServer).ToString() : string.Empty, scenarioName, scenarioDescription, performanceCounterName, userName) { this.LocalSite = ((!string.IsNullOrEmpty(localSite)) ? AdSiteIdParameter.Parse(localSite).ToString() : string.Empty); this.SecureAccess = secureAccess; }
public override void Work() { Thread.Sleep(15000); int num = 1440; for (;;) { try { if (!int.TryParse(ConfigurationManager.AppSettings["CertificateNotificationPollIntervalInMinutes"], out num)) { num = 1440; } } catch (ConfigurationException) { num = 1440; } if (num <= 0 || num > 14400) { num = 1440; } try { if (!int.TryParse(ConfigurationManager.AppSettings["CertificateNotificationWarningDays"], out this.warningDays)) { this.warningDays = 30; } } catch (ConfigurationException) { this.warningDays = 30; } if (this.warningDays <= 0 || this.warningDays > 400) { this.warningDays = 30; } this.adSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 185, "Work", "f:\\15.00.1497\\sources\\dev\\Management\\src\\ServiceHost\\Servicelets\\CertificateNotification\\Program\\CertificateNotificationServicelet.cs"); this.orgId = ADSessionSettings.FromRootOrgScopeSet().CurrentOrganizationId; ExchangeCertificateRpc exchangeCertificateRpc = new ExchangeCertificateRpc(); byte[] outputBlob = null; ExchangeCertificateRpcClient exchangeCertificateRpcClient = null; ExchangeCertificateRpcClient2 exchangeCertificateRpcClient2 = null; try { IEnumerable <Server> objects = new ServerIdParameter().GetObjects <Server>(this.orgId.ConfigurationUnit, this.adSession); if (objects == null || objects.Count <Server>() == 0) { goto IL_28B; } this.serverObj = objects.First <Server>(); ExchangeCertificateRpcVersion exchangeCertificateRpcVersion = ExchangeCertificateRpcVersion.Version1; try { byte[] inBlob = exchangeCertificateRpc.SerializeInputParameters(ExchangeCertificateRpcVersion.Version2); exchangeCertificateRpcClient2 = new ExchangeCertificateRpcClient2(this.serverObj.Name); outputBlob = exchangeCertificateRpcClient2.GetCertificate2(0, inBlob); exchangeCertificateRpcVersion = ExchangeCertificateRpcVersion.Version2; } catch (RpcException) { exchangeCertificateRpcVersion = ExchangeCertificateRpcVersion.Version1; } if (exchangeCertificateRpcVersion == ExchangeCertificateRpcVersion.Version1) { byte[] inBlob2 = exchangeCertificateRpc.SerializeInputParameters(exchangeCertificateRpcVersion); exchangeCertificateRpcClient = new ExchangeCertificateRpcClient(this.serverObj.Name); outputBlob = exchangeCertificateRpcClient.GetCertificate(0, inBlob2); } ExchangeCertificateRpc exchangeCertificateRpc2 = new ExchangeCertificateRpc(exchangeCertificateRpcVersion, null, outputBlob); this.UpdateDataInMbx(exchangeCertificateRpc2.ReturnCertList); } catch (RpcClientException ex) { this.EventLog.LogEvent(CertificateNotificationEventLogConstants.Tuple_TransientException, string.Empty, new object[] { ex.ToString() }); } catch (LocalizedException ex2) { this.EventLog.LogEvent(CertificateNotificationEventLogConstants.Tuple_TransientException, string.Empty, new object[] { ex2.ToString() }); } catch (RpcException ex3) { this.EventLog.LogEvent(CertificateNotificationEventLogConstants.Tuple_TransientException, string.Empty, new object[] { ex3.ToString() }); } finally { if (exchangeCertificateRpcClient2 != null) { exchangeCertificateRpcClient2.Dispose(); } if (exchangeCertificateRpcClient != null) { exchangeCertificateRpcClient.Dispose(); } this.adSession = null; this.asyncDataProvider = null; this.serverObj = null; this.orgId = null; } goto IL_252; IL_28B: if (base.StopEvent.WaitOne(TimeSpan.FromMinutes((double)num), false)) { break; } continue; IL_252: this.EventLog.LogEvent(CertificateNotificationEventLogConstants.Tuple_OneRoundCompleted, string.Empty, new object[] { ExDateTime.Now.AddMinutes((double)num) }); goto IL_28B; } }
public ClientAccessArrayNotFoundException(string site, ServerIdParameter serverId, Exception innerException) : base(Strings.messageClientAccessArrayNotFoundException(site, serverId), innerException) { this.site = site; this.serverId = serverId; }
public ResubmitRequestDataProvider(ServerIdParameter serverId, ResubmitRequestId identity) { this.serverIdentity = (serverId ?? new ServerIdParameter()); this.resubmitRequestIdentity = identity; }