private void UpdateVDirScriptMaps() { TaskLogger.LogEnter(); using (DirectoryEntry directoryEntry = IisUtility.CreateIISDirectoryEntry(this.DataObject.MetabasePath, new Task.TaskErrorLoggingReThrowDelegate(this.WriteError), this.DataObject.Identity)) { string[] array = new string[directoryEntry.Properties["ScriptMaps"].Count]; directoryEntry.Properties["ScriptMaps"].CopyTo(array, 0); ExTraceGlobals.TaskTracer.Information((long)this.GetHashCode(), "UpdateVDirScriptMaps got ScriptMaps property"); int num = 0; string[] array2 = array; int i = 0; while (i < array2.Length) { string text = array2[i]; if (text.StartsWith(".aspx", StringComparison.OrdinalIgnoreCase)) { ExTraceGlobals.TaskTracer.Information <string>((long)this.GetHashCode(), "UpdateVDirScriptMaps found .aspx mapping: {0}", text); if (text.IndexOf(",options", StringComparison.OrdinalIgnoreCase) >= 0) { ExTraceGlobals.TaskTracer.Information((long)this.GetHashCode(), "Leaving UpdateVDirScriptMaps without updating .aspx mapping."); return; } string text2 = text + ",OPTIONS"; directoryEntry.Properties["ScriptMaps"][num] = text2; ExTraceGlobals.TaskTracer.Information <string>((long)this.GetHashCode(), "UpdateVDirScriptMaps updated .aspx mapping to: {0}", text2); break; } else { num++; i++; } } directoryEntry.CommitChanges(); IisUtility.CommitMetabaseChanges((base.OwningServer == null) ? null : base.OwningServer.Name); ExTraceGlobals.TaskTracer.Information((long)this.GetHashCode(), "UpdateVDirScriptMaps committed mapping edit to vDir object."); } TaskLogger.LogExit(); }
protected override void InternalValidate() { TaskLogger.LogEnter(); base.InternalValidate(); ((IConfigurationSession)base.DataSession).SessionSettings.IsSharedConfigChecked = true; if (!this.IgnoreDehydratedFlag) { SharedConfigurationTaskHelper.VerifyIsNotTinyTenant(base.CurrentOrgState, new Task.ErrorLoggerDelegate(base.WriteError)); } if (this.DataObject.LanguageBlockList != null) { foreach (string text in this.DataObject.LanguageBlockList) { if (!HygieneUtils.IsAntispamFilterableLanguage(text)) { base.WriteError(new ArgumentException(Strings.ErrorUnsupportedBlockLanguage(text)), ErrorCategory.InvalidArgument, text); } } } if (this.DataObject.RegionBlockList != null) { foreach (string text2 in this.DataObject.RegionBlockList) { if (!HygieneUtils.IsValidIso3166Alpha2Code(text2)) { base.WriteError(new ArgumentException(Strings.ErrorInvalidIso3166Alpha2Code(text2)), ErrorCategory.InvalidArgument, text2); } } } if (this.DataObject.IsModified(HostedContentFilterPolicySchema.EnableEndUserSpamNotifications) && this.DataObject.EnableEndUserSpamNotifications) { HostedContentFilterRule policyScopingRule = this.GetPolicyScopingRule(); if (policyScopingRule != null && !policyScopingRule.IsEsnCompatible) { base.WriteError(new OperationNotAllowedException(Strings.ErrorEsnIncompatibleRule(policyScopingRule.Name)), ErrorCategory.InvalidOperation, null); } } TaskLogger.LogExit(); }
protected override void PrepareRecipientObject(ADUser user) { TaskLogger.LogEnter(); base.PrepareRecipientObject(user); if (this.WindowsLiveID != null && this.WindowsLiveID.SmtpAddress != SmtpAddress.Empty) { MailboxTaskHelper.IsLiveIdExists((IRecipientSession)base.DataSession, user.WindowsLiveID, user.NetID, new Task.ErrorLoggerDelegate(base.WriteError)); user.UserPrincipalName = user.WindowsLiveID.ToString(); } if (!user.IsModified(ADRecipientSchema.DisplayName)) { user.DisplayName = user.Name; } SoftDeletedTaskHelper.UpdateShadowWhenSoftDeletedProperty((IRecipientSession)base.DataSession, this.ConfigurationSession, base.CurrentOrganizationId, this.DataObject); this.DataObject.RecipientSoftDeletedStatus = 0; this.DataObject.WhenSoftDeleted = null; this.DataObject.InternalOnly = false; this.DataObject.propertyBag.MarkAsChanged(ADRecipientSchema.RecipientSoftDeletedStatus); this.DataObject.propertyBag.MarkAsChanged(ADRecipientSchema.WhenSoftDeleted); this.DataObject.propertyBag.MarkAsChanged(ADRecipientSchema.TransportSettingFlags); TaskLogger.LogExit(); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); if (this.DataObject != null && SharedConfiguration.IsSharedConfiguration(this.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(this.DataObject.OrganizationId.OrganizationalUnit.Name))) { TaskLogger.LogExit(); return; } if (this.Mailbox != null) { ExchangePrincipal exchangePrincipal = this.ProcessPrimaryMailbox(); IRecipientSession recipientSession; ADUser user = StoreRetentionPolicyTagHelper.FetchRecipientFromMailboxId(base.DomainController, this.Mailbox, out recipientSession, exchangePrincipal.MailboxInfo.OrganizationId); if (exchangePrincipal != null && StoreRetentionPolicyTagHelper.HasOnPremArchiveMailbox(user)) { this.ProcessArchiveMailbox(); } } else { bool flag = this.DataObject.IsChanged(ADObjectSchema.Name); if (this.DataObject.IsChanged(RetentionPolicyTagSchema.RetentionId) && !this.Force && !base.ShouldContinue(Strings.WarningRetentionTagIdChange(this.DataObject.Identity.ToString()))) { return; } base.InternalProcessRecord(); if (this.contentSettingsObject.ObjectState == ObjectState.Changed) { if (flag) { ElcContentSettings elcContentSettings = this.DataObject.GetELCContentSettings().FirstOrDefault <ElcContentSettings>(); elcContentSettings.CopyChangesFrom(this.contentSettingsObject); this.contentSettingsObject = elcContentSettings; } base.DataSession.Save(this.contentSettingsObject); } } TaskLogger.LogExit(); }
protected override void InternalValidate() { TaskLogger.LogEnter(); base.InternalValidate(); if (this.DataObject.IsChanged(OfflineAddressBookSchema.IsDefault) && !this.DataObject.IsDefault) { base.WriteError(new InvalidOperationException(Strings.CannotResetDefaultOAB), ErrorCategory.InvalidOperation, this.Identity); } if (this.DataObject.IsModified(OfflineAddressBookSchema.ConfiguredAttributes)) { try { this.DataObject.UpdateRawMapiAttributes(false); } catch (ArgumentException exception) { base.WriteError(exception, ErrorCategory.InvalidArgument, this.DataObject); } } this.ThrowErrorIfUnsupportedParameterIsSpecified(); TaskLogger.LogExit(); }
protected override void InternalValidate() { TaskLogger.LogEnter(); base.InternalValidate(); DatabaseAvailabilityGroupNetwork dataObject = this.DataObject; DagNetworkObjectId dagNetworkObjectId = (DagNetworkObjectId)dataObject.Identity; ExTraceGlobals.CmdletsTracer.TraceError <string>((long)this.GetHashCode(), "Validating SetDAGNetwork({0})", dagNetworkObjectId.FullName); IConfigurationSession configSession = this.SetupAdSession(); DatabaseAvailabilityGroup dag = DagTaskHelper.ReadDagByName(dagNetworkObjectId.DagName, configSession); DagTaskHelper.VerifyDagAndServersAreWithinScopes <DatabaseAvailabilityGroupNetwork>(this, dag, true); DagTaskHelper.PreventTaskWhenAutoNetConfigIsEnabled(dag, this); DagNetworkConfigDataProvider dagNetworkConfigDataProvider = (DagNetworkConfigDataProvider)base.DataSession; DagNetworkConfiguration networkConfig = dagNetworkConfigDataProvider.NetworkConfig; DatabaseAvailabilityGroupNetwork databaseAvailabilityGroupNetwork = (DatabaseAvailabilityGroupNetwork)dataObject.GetOriginalObject(); string name = databaseAvailabilityGroupNetwork.Name; DatabaseAvailabilityGroupNetwork networkBeingChanged = null; foreach (DatabaseAvailabilityGroupNetwork databaseAvailabilityGroupNetwork2 in networkConfig.Networks) { if (databaseAvailabilityGroupNetwork2 == dataObject) { networkBeingChanged = databaseAvailabilityGroupNetwork2; } else if (DatabaseAvailabilityGroupNetwork.NameComparer.Equals(databaseAvailabilityGroupNetwork2.Name, dataObject.Name)) { throw new DagNetworkManagementException(ServerStrings.DagNetworkRenameDupName(name, dataObject.Name)); } } DagNetworkValidation.ValidateSwitches(dataObject, new Task.TaskErrorLoggingDelegate(base.WriteError)); if (base.Fields["Subnets"] != null) { DagNetworkValidation.ValidateSubnets(this.Subnets, networkConfig, dataObject.Name, networkBeingChanged, new Task.TaskErrorLoggingDelegate(base.WriteError), new Task.TaskWarningLoggingDelegate(this.WriteWarning), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose)); dataObject.ReplaceSubnets(this.Subnets); } DagNetworkValidation.WarnIfAllNetsAreDisabled(networkConfig, new Task.TaskWarningLoggingDelegate(this.WriteWarning)); TaskLogger.LogExit(); }
protected override void InternalValidate() { TaskLogger.LogEnter(); if (this.Instance.IsModified(ADObjectSchema.Name)) { base.WriteError(new InvalidOperationException(Strings.ErrorServerNameModified), ErrorCategory.InvalidOperation, this.Identity); } if (this.Identity != null) { this.Identity = FrontendTransportServerIdParameter.CreateIdentity(this.Identity); } base.InternalValidate(); if (!this.DataObject.IsFrontendTransportServer) { base.WriteError(new InvalidOperationException(Strings.ErrorTaskRunningLocationFrontendOnly), ErrorCategory.InvalidOperation, null); } if (base.HasErrors) { return; } TaskLogger.LogExit(); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(new object[] { this.Identity }); if (this.Identity != null) { LocalizedString? localizedString; IEnumerable <ADUser> dataObjects = base.GetDataObjects(this.Identity, base.OptionalIdentityData, out localizedString); this.WriteResult <ADUser>(dataObjects); if (!base.HasErrors && !this.HasObjectMatchingIdentity) { base.WriteError(new ManagementObjectNotFoundException(localizedString ?? base.GetErrorMessageObjectNotFound(this.Identity.ToString(), typeof(MailboxIdParameter).ToString(), (base.DataSession != null) ? base.DataSession.Source : null)), ErrorCategory.InvalidData, null); } } else { base.InternalProcessRecord(); } TaskLogger.LogExit(); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); CmdletProxy.ThrowExceptionIfProxyIsNeeded(base.CurrentTaskContext, base.DataObject, false, this.ConfirmationMessage, null); try { ADUser dataObject = base.DataObject; if (dataObject == null) { base.WriteError(new ObjectNotFoundException(Strings.MailboxAssociationMailboxNotFound), ExchangeErrorCategory.Client, base.DataObject); } else { IRecipientSession adSession = (IRecipientSession)base.DataSession; MailboxAssociationContext mailboxAssociationContext = new MailboxAssociationContext(adSession, dataObject, "Remove-MailboxAssociation", this.Identity, false); mailboxAssociationContext.Execute(new Action <MailboxAssociationFromStore, IAssociationAdaptor, ADUser, IExtensibleLogger>(this.DeleteMailboxAssociation)); } } catch (StorageTransientException exception) { base.WriteError(exception, ExchangeErrorCategory.ServerTransient, this.Identity.MailboxId); } catch (StoragePermanentException exception2) { base.WriteError(exception2, ExchangeErrorCategory.ServerOperation, this.Identity.MailboxId); } catch (AssociationNotFoundException exception3) { base.WriteError(exception3, ExchangeErrorCategory.ServerOperation, this.Identity.MailboxId); } catch (MailboxNotFoundException exception4) { base.WriteError(exception4, ExchangeErrorCategory.ServerOperation, this.Identity.MailboxId); } finally { TaskLogger.LogExit(); } }
protected override IConfigurable PrepareDataObject() { TaskLogger.LogEnter(); this.DataObject = (ExchangeRoleAssignment)base.PrepareDataObject(); if (base.HasErrors) { return(null); } ADRecipient adrecipient = (ADRecipient)base.GetDataObject <ADRecipient>(this.User, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.ErrorUserOrSecurityGroupNotFound(this.User.ToString())), new LocalizedString?(Strings.ErrorUserOrSecurityGroupNotUnique(this.User.ToString()))); RoleHelper.ValidateRoleAssignmentUser(adrecipient, new Task.TaskErrorLoggingDelegate(base.WriteError), false); this.originalUserId = this.DataObject.User; this.DataObject.User = adrecipient.Id; this.DataObject.RoleAssigneeType = ExchangeRoleAssignment.RoleAssigneeTypeFromADRecipient(adrecipient); ((IDirectorySession)base.DataSession).LinkResolutionServer = adrecipient.OriginatingServer; if (!adrecipient.OrganizationId.Equals(OrganizationId.ForestWideOrgId) && !adrecipient.OrganizationId.Equals(this.DataObject.OrganizationId) && (OrganizationId.ForestWideOrgId.Equals(this.DataObject.OrganizationId) || !this.DataObject.OrganizationId.OrganizationalUnit.IsDescendantOf(adrecipient.OrganizationId.OrganizationalUnit))) { base.WriteError(new InvalidOperationException(Strings.ErrorOrgUserBeAssignedToParentOrg(this.User.ToString())), ErrorCategory.InvalidOperation, this.DataObject.Id); } TaskLogger.LogExit(); return(this.DataObject); }
private static int RunProcess(string fileName, string arguments, WriteVerboseDelegate writeVerbose) { TaskLogger.LogEnter(); writeVerbose(Strings.LogRunningCommand(fileName, arguments)); int exitCode; using (Process process = Process.Start(new ProcessStartInfo { FileName = fileName, Arguments = arguments, CreateNoWindow = true, WindowStyle = ProcessWindowStyle.Hidden, UseShellExecute = false })) { process.WaitForExit(); writeVerbose(Strings.LogProcessExitCode(fileName, process.ExitCode)); TaskLogger.LogExit(); exitCode = process.ExitCode; } return(exitCode); }
protected override void ApplyModification(ActiveDirectoryAccessRule[] modifiedAces) { TaskLogger.LogEnter(); if (this.trustee != null) { List <ActiveDirectoryAccessRule> list = new List <ActiveDirectoryAccessRule>(); foreach (SecurityIdentifier identity in ((IADSecurityPrincipal)this.trustee).SidHistory) { foreach (RecipientAccessRight right in base.AccessRights) { list.Add(new ActiveDirectoryAccessRule(identity, ActiveDirectoryRights.ExtendedRight, AccessControlType.Allow, RecipientPermissionHelper.GetRecipientAccessRightGuid(right), this.GetInheritanceType(), Guid.Empty)); } } if (list.Count > 0) { list.AddRange(modifiedAces); modifiedAces = list.ToArray(); } } DirectoryCommon.RemoveAces(new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.TaskWarningLoggingDelegate(this.WriteWarning), new Task.ErrorLoggerDelegate(base.WriteError), this.DataObject, modifiedAces); TaskLogger.LogExit(); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); if (base.Fields["Immediate"] != null && (bool)base.Fields["Immediate"]) { this.DataObject.Status = GatewayStatus.Disabled; } else { this.DataObject.Status = GatewayStatus.NoNewCalls; } base.InternalProcessRecord(); if (!base.HasErrors) { UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_IPGatewayDisabled, null, new object[] { this.DataObject.Name, this.DataObject.Address.ToString() }); } TaskLogger.LogExit(); }
protected override List <CasTransactionOutcome> ExecuteTests(TestCasConnectivity.TestCasConnectivityRunInstance instance) { TaskLogger.LogEnter(); try { instance.baseUri = new UriBuilder(new Uri(instance.baseUri, "calendar/")) { Scheme = Uri.UriSchemeHttp, Port = 80 }.Uri; CasTransactionOutcome casTransactionOutcome = this.BuildOutcome(base.ApplicationShortName, base.ApplicationName, instance); casTransactionOutcome.Update(CasTransactionResultEnum.Success); this.ExecuteCalendarVDirTests(instance, casTransactionOutcome); instance.Result.Outcomes.Add(casTransactionOutcome); } finally { instance.Result.Complete(); TaskLogger.LogExit(); } return(null); }
public static bool IsInstalled(Guid ProductCode) { TaskLogger.LogEnter(); bool result = false; if (Guid.Empty == ProductCode) { throw new ArgumentNullException("ProductCode", Strings.ExceptionProductInfoRequired); } MsiUtility.PushUILevel(InstallUILevel.None); try { InstallState installState = MsiNativeMethods.QueryProductState(ProductCode.ToString("B").ToUpper(CultureInfo.InvariantCulture)); result = (installState != InstallState.Unknown); } finally { MsiUtility.PopUILevel(); } TaskLogger.LogExit(); return(result); }
private void RemoveInvalidRoleAssignments() { TaskLogger.LogEnter(); QueryFilter filter = new OrFilter(new QueryFilter[] { new NotFilter(new ExistsFilter(ExchangeRoleAssignmentSchema.Role)), new NotFilter(new ExistsFilter(ExchangeRoleAssignmentSchema.User)) }); ADPagedReader <ExchangeRoleAssignment> adpagedReader = this.configurationSession.FindPaged <ExchangeRoleAssignment>(base.OrgContainerId.GetDescendantId(ExchangeRoleAssignment.RdnContainer), QueryScope.OneLevel, filter, null, 0); foreach (ExchangeRoleAssignment roleAssignment in adpagedReader) { this.RemoveRoleAssignment(roleAssignment); } if (this.adSplitPermissionMode) { List <QueryFilter> list = new List <QueryFilter>(); foreach (RoleType roleType in InstallCannedRbacRoleAssignments.invalidRoleTypesInADSplitPermissionMode) { list.Add(new ComparisonFilter(ComparisonOperator.Equal, ExchangeRoleSchema.RoleType, roleType)); } ADPagedReader <ExchangeRole> adpagedReader2 = this.configurationSession.FindPaged <ExchangeRole>(base.OrgContainerId.GetDescendantId(ExchangeRole.RdnContainer), QueryScope.SubTree, QueryFilter.OrTogether(list.ToArray()), null, 0); List <QueryFilter> list2 = new List <QueryFilter>(); foreach (ExchangeRole exchangeRole in adpagedReader2) { list2.Add(new ComparisonFilter(ComparisonOperator.Equal, ExchangeRoleAssignmentSchema.Role, exchangeRole.Id)); } ADPagedReader <ExchangeRoleAssignment> adpagedReader3 = this.configurationSession.FindPaged <ExchangeRoleAssignment>(base.OrgContainerId.GetDescendantId(ExchangeRoleAssignment.RdnContainer), QueryScope.OneLevel, QueryFilter.AndTogether(new QueryFilter[] { InstallCannedRbacRoleAssignments.regularRoleAssignmentFilter, QueryFilter.OrTogether(list2.ToArray()) }), null, 0); foreach (ExchangeRoleAssignment roleAssignment2 in adpagedReader3) { this.RemoveRoleAssignment(roleAssignment2); } } TaskLogger.LogExit(); }
protected override void WriteResult(IConfigurable dataObject) { TaskLogger.LogEnter(); try { ADUser aduser = (ADUser)dataObject; MailboxAssociationPresentationObject mailboxAssociationPresentationObject = new MailboxAssociationPresentationObject(); if (!CmdletProxy.TryToProxyOutputObject(mailboxAssociationPresentationObject, base.CurrentTaskContext, aduser, false, this.ConfirmationMessage, null)) { IRecipientSession adSession = (IRecipientSession)base.DataSession; MailboxAssociationContext mailboxAssociationContext = new MailboxAssociationContext(adSession, aduser, "Get-MailboxAssociation", this.Identity, this.IncludeNotPromotedProperties); mailboxAssociationContext.Execute(new Action <MailboxAssociationFromStore, IAssociationAdaptor, ADUser, IExtensibleLogger>(this.WriteMailboxAssociation)); } else { base.WriteResult(mailboxAssociationPresentationObject); } } catch (StorageTransientException exception) { base.WriteError(exception, ErrorCategory.ReadError, this.Identity.MailboxId); } catch (StoragePermanentException exception2) { base.WriteError(exception2, ErrorCategory.ReadError, this.Identity.MailboxId); } catch (AssociationNotFoundException exception3) { base.WriteError(exception3, ErrorCategory.ReadError, this.Identity.MailboxId); } catch (MailboxNotFoundException exception4) { base.WriteError(exception4, ErrorCategory.ReadError, this.Identity.MailboxId); } finally { TaskLogger.LogExit(); } }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); if (this.DataObject != null && SharedConfiguration.IsSharedConfiguration(this.DataObject.OrganizationId) && !base.ShouldContinue(Strings.ConfirmSharedConfiguration(this.DataObject.OrganizationId.OrganizationalUnit.Name))) { TaskLogger.LogExit(); return; } if (this.updateExistingDefaultPolicies) { try { DefaultMailboxPolicyUtility <TeamMailboxProvisioningPolicy> .ClearDefaultPolicies(base.DataSession as IConfigurationSession, this.existingDefaultPolicies); } catch (DataSourceTransientException exception) { base.WriteError(exception, ErrorCategory.ReadError, null); } } base.InternalProcessRecord(); TaskLogger.LogExit(); }
protected override void InternalValidate() { TaskLogger.LogEnter(); base.InternalValidate(); if (base.HasErrors) { return; } ManageTenantOutboundConnectors.ValidateOutboundConnectorDataObject(this.DataObject, this, base.DataSession, this.BypassValidation); IEnumerable <TenantOutboundConnector> enumerable = base.DataSession.FindPaged <TenantOutboundConnector>(null, ((IConfigurationSession)base.DataSession).GetOrgContainerId().GetDescendantId(this.DataObject.ParentPath), false, null, ADGenericPagedReader <TenantOutboundConnector> .DefaultPageSize); foreach (TenantOutboundConnector tenantOutboundConnector in enumerable) { if (StringComparer.OrdinalIgnoreCase.Equals(this.DataObject.Name, tenantOutboundConnector.Name)) { base.WriteError(new ErrorOutboundConnectorAlreadyExistsException(tenantOutboundConnector.Name), ErrorCategory.InvalidOperation, null); break; } } ManageTenantOutboundConnectors.ValidateIfAcceptedDomainsCanBeRoutedWithConnectors(this.DataObject, base.DataSession, this, false); TaskLogger.LogExit(); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); if (this.ClassificationRuleCollectionIdentity != null) { LocalizedString? localizedString; IEnumerable <TransportRule> dataObjects = base.GetDataObjects <TransportRule>(this.ClassificationRuleCollectionIdentity, base.DataSession, this.RootId, base.OptionalIdentityData, out localizedString); this.writeRuleCollectionCount = 0; this.WriteResult <TransportRule>(dataObjects); if (!base.HasErrors && base.WriteObjectCount == 0U) { LocalizedString message = LocalizedString.Empty; if (this.writeRuleCollectionCount > 0) { message = Strings.DataClassificationRequiresHigherServerVersion(this.ClassificationRuleCollectionIdentity.ToString()); } else { message = (localizedString ?? base.GetErrorMessageObjectNotFound(this.ClassificationRuleCollectionIdentity.ToString(), typeof(TransportRule).ToString(), (base.DataSession != null) ? base.DataSession.Source : null)); } base.WriteError(new ManagementObjectNotFoundException(message), (ErrorCategory)1003, null); } } else { try { base.InternalProcessRecord(); } catch (ManagementObjectNotFoundException) { if (this.isIdentityArgumentSpecified) { throw; } } } TaskLogger.LogExit(); }
protected override void PrepareRecipientObject(ref ADUser user) { TaskLogger.LogEnter(); base.PrepareRecipientObject(ref user); if (!this.IsValidUser(user)) { base.WriteError(new RecipientTaskException(Strings.ErrorInvalidRecipientType(user.Identity.ToString(), user.RecipientType.ToString())), ErrorCategory.InvalidArgument, user.Id); } if (user.RecipientType != RecipientType.MailUser) { user.SetExchangeVersion(ExchangeObjectVersion.Exchange2010); List <PropertyDefinition> list = new List <PropertyDefinition>(RecipientConstants.DisableMailUserBase_PropertiesToReset); MailboxTaskHelper.RemovePersistentProperties(list); MailboxTaskHelper.ClearExchangeProperties(user, list); user.SetExchangeVersion(ExchangeObjectVersion.Exchange2010); if (this.DelayProvisioning && base.IsProvisioningLayerAvailable) { this.ProvisionDefaultValues(new ADUser(), user); } } TaskLogger.LogExit(); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); bool flag = false; IRMConfiguration irmconfiguration = IRMConfiguration.Read((IConfigurationSession)base.DataSession, out flag); if (irmconfiguration == null) { base.WriteError(new FailedToAccessIrmConfigurationException(), (ErrorCategory)1002, this.Identity); } if (base.DataObject.Default) { if (!this.Force && !base.ShouldContinue(Strings.RemoveDefaultTPD(this.Identity.ToString()))) { TaskLogger.LogExit(); return; } irmconfiguration.InternalLicensingEnabled = false; irmconfiguration.SharedServerBoxRacIdentity = null; irmconfiguration.PublishingLocation = null; irmconfiguration.ServiceLocation = null; irmconfiguration.LicensingLocation = null; } else { if (irmconfiguration.LicensingLocation.Contains(base.DataObject.IntranetLicensingUrl)) { irmconfiguration.LicensingLocation.Remove(base.DataObject.IntranetLicensingUrl); } if (irmconfiguration.LicensingLocation.Contains(base.DataObject.ExtranetLicensingUrl)) { irmconfiguration.LicensingLocation.Remove(base.DataObject.ExtranetLicensingUrl); } } base.DataSession.Save(irmconfiguration); base.InternalProcessRecord(); TaskLogger.LogExit(); }
protected override void InternalValidate() { TaskLogger.LogEnter(); Organization orgContainer = base.Session.GetOrgContainer(); if (OrganizationId.ForestWideOrgId.Equals(orgContainer.OrganizationId) && orgContainer.ObjectVersion < Organization.OrgConfigurationVersion) { base.WriteError(new InvalidOperationException(Strings.ErrorEnterpriseOrgOutOfDate), (ErrorCategory)1000, null); } IEnumerable <ExchangeConfigurationUnit> objects = this.Identity.GetObjects <ExchangeConfigurationUnit>(null, base.Session); using (IEnumerator <ExchangeConfigurationUnit> enumerator = objects.GetEnumerator()) { if (!enumerator.MoveNext()) { throw new ManagementObjectNotFoundException(Strings.ErrorOrganizationNotFound(this.Identity.ToString())); } this.tenantCU = enumerator.Current; if (enumerator.MoveNext()) { throw new ManagementObjectAmbiguousException(Strings.ErrorManagementObjectAmbiguous(this.Identity.ToString())); } } if (this.tenantCU != null) { base.CurrentOrganizationId = this.tenantCU.OrganizationId; } this.tenantFQDN = this.CreateTenantSession(this.tenantCU.OrganizationId, true, ConsistencyMode.FullyConsistent).GetDefaultAcceptedDomain(); if (this.tenantFQDN == null) { throw new ManagementObjectNotFoundException(Strings.ErrorNoDefaultAcceptedDomainFound(this.Identity.ToString())); } if (this.tenantCU.OrganizationStatus != OrganizationStatus.Active && this.tenantCU.OrganizationStatus != OrganizationStatus.Suspended && this.tenantCU.OrganizationStatus != OrganizationStatus.LockedOut) { base.WriteError(new InvalidOperationException(Strings.ErrorOrganizationNotUpgradable(this.Identity.ToString(), this.tenantCU.OrganizationStatus.ToString())), ErrorCategory.InvalidOperation, null); } TaskLogger.LogExit(); }
protected override void InternalValidate() { TaskLogger.LogEnter(); byte[] array = null; byte[] array2 = null; bool flag = false; try { flag = RulePackageDecrypter.DecryptRulePackage(this.FileData, out array, out array2); } catch (Exception innerException) { base.WriteError(new ClassificationRuleCollectionDecryptionException(innerException), ErrorCategory.InvalidData, null); } XDocument xdocument = this.ValidateAgainstSchema(flag ? array : this.FileData); this.SetIdentityParameter(xdocument); if (base.OptionalIdentityData != null) { base.OptionalIdentityData.ConfigurationContainerRdn = ClassificationDefinitionConstants.ClassificationDefinitionsRdn; } this.DataObject = (TransportRule)this.ResolveDataObject(); if (base.HasErrors) { return; } ExAssert.RetailAssert(this.DataObject != null, "DataObject must not be null at this point."); if (VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled) { this.ValidateOperationScope(); } string s = this.ValidateAgainstBusinessRulesAndReadMetadata(xdocument); this.FileData = (flag ? array2 : Encoding.Unicode.GetBytes(s)); base.InternalValidate(); TaskLogger.LogExit(); }
protected override IConfigurable PrepareDataObject() { TaskLogger.LogEnter(); TransportRule transportRule = (TransportRule)base.PrepareDataObject(); if (base.HasErrors) { return(null); } JournalingRule journalingRule; try { journalingRule = (JournalingRule)JournalingRuleParser.Instance.GetRule(transportRule.Xml); } catch (ParserException exception) { base.WriteError(exception, ErrorCategory.InvalidData, null); return(null); } if (journalingRule.GccRuleType != GccType.None && !this.LawfulInterception) { LocalizedString errorMessageObjectNotFound = base.GetErrorMessageObjectNotFound((this.Identity != null) ? this.Identity.ToString() : null, typeof(RuleIdParameter).ToString(), (base.DataSession != null) ? base.DataSession.Source : null); base.WriteError(new ManagementObjectNotFoundException(errorMessageObjectNotFound), ErrorCategory.ObjectNotFound, null); return(null); } if (journalingRule.IsTooAdvancedToParse) { base.WriteError(new InvalidOperationException(Strings.CannotModifyRuleDueToVersion(journalingRule.Name)), ErrorCategory.InvalidOperation, null); return(null); } journalingRule.Enabled = RuleState.Disabled; string xml = JournalingRuleSerializer.Instance.SaveRuleToString(journalingRule); transportRule.Xml = xml; TaskLogger.LogExit(); return(transportRule); }
protected override void InternalValidate() { TaskLogger.LogEnter(); if (this.skipExecution) { return; } this.DataObject = (OfflineAddressBook)this.PrepareDataObject(); if (this.DataObject.WebDistributionEnabled) { base.WriteVerbose(Strings.VerboseDefaultOABWebDistributionEnabled(this.DataObject.DistinguishedName)); this.skipExecution = true; return; } ITopologyConfigurationSession topologyConfigurationSession = base.DataSession as ITopologyConfigurationSession; this.localOABVDirs = topologyConfigurationSession.FindOABVirtualDirectoriesForLocalServer(); if (this.localOABVDirs == null || this.localOABVDirs.Length == 0) { base.WriteVerbose(Strings.VerboseNoOabVDirOnLocalServer); this.skipExecution = true; return; } if (this.DataObject.IsReadOnly) { base.WriteVerbose(Strings.VerboseDefaultOABIsNewerThanVersionE12(this.DataObject.DistinguishedName, this.DataObject.ExchangeVersion.ExchangeBuild.ToString())); this.skipExecution = true; return; } if (this.DataObject.ExchangeVersion.IsOlderThan(ExchangeObjectVersion.Exchange2007)) { base.WriteVerbose(Strings.VerboseDefaultOABIsOlderThanVersionE12(this.DataObject.DistinguishedName)); this.skipExecution = true; return; } base.InternalValidate(); TaskLogger.LogExit(); }
protected override void InternalBeginProcessing() { TaskLogger.LogEnter(); base.InternalBeginProcessing(); CASMailbox casmailbox = (CASMailbox)this.GetDynamicParameters(); if (casmailbox.EwsAllowListSpecified && casmailbox.EwsBlockListSpecified) { base.ThrowTerminatingError(new ArgumentException(Strings.ErrorEwsAllowListAndEwsBlockListSpecified), ErrorCategory.InvalidArgument, null); } if (casmailbox.IsModified(CASMailboxSchema.EwsApplicationAccessPolicy)) { if (!casmailbox.EwsAllowListSpecified && !casmailbox.EwsBlockListSpecified) { casmailbox.EwsExceptions = null; } if (casmailbox.EwsApplicationAccessPolicy == EwsApplicationAccessPolicy.EnforceAllowList && casmailbox.EwsBlockListSpecified) { base.ThrowTerminatingError(new ArgumentException(Strings.ErrorEwsEnforceAllowListAndEwsBlockListSpecified), ErrorCategory.InvalidArgument, null); } if (casmailbox.EwsApplicationAccessPolicy == EwsApplicationAccessPolicy.EnforceBlockList && casmailbox.EwsAllowListSpecified) { base.ThrowTerminatingError(new ArgumentException(Strings.ErrorEwsEnforceBlockListAndEwsAllowListSpecified), ErrorCategory.InvalidArgument, null); } } else { if (casmailbox.EwsAllowListSpecified) { casmailbox.EwsApplicationAccessPolicy = new EwsApplicationAccessPolicy?(EwsApplicationAccessPolicy.EnforceAllowList); } if (casmailbox.EwsBlockListSpecified) { casmailbox.EwsApplicationAccessPolicy = new EwsApplicationAccessPolicy?(EwsApplicationAccessPolicy.EnforceBlockList); } } TaskLogger.LogExit(); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); this.InternalBeginProcessing(); string text = this.rootDomain.Id.ToDNString(); foreach (Tuple <string, List <SecurityIdentifier>, List <SecurityIdentifier> > tuple in InitializeDkmDatacenter.DkmContainersToCreate) { try { DkmProxy dkmProxy = null; try { this.CreateDkmContainer(tuple.Item1, string.Format("{0},{1}", "CN=Microsoft,CN=Program Data", text), out dkmProxy); } catch (ObjectAlreadyExistsException) { this.WriteWarning(Strings.DkmContainerAlreadyExists(tuple.Item1)); } if (dkmProxy != null) { this.RemoveUnwantedDkmContainerAccessRules(tuple.Item1, tuple.Item2, tuple.Item3, text); InitializeDkmDatacenter.SetDkmContainerAccessRules(dkmProxy, tuple.Item2, tuple.Item3); } } catch (Exception ex) { this.WriteWarning(Strings.DkmProvisioningException(tuple.Item1, ex)); ExManagementApplicationLogger.LogEvent(ManagementEventLogConstants.Tuple_DkmProvisioningException, new string[] { ex.ToString() }); throw; } } ExManagementApplicationLogger.LogEvent(ManagementEventLogConstants.Tuple_DkmProvisioningSuccessful, new string[0]); TaskLogger.LogExit(); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); if (this.OrganizationalUnit != null) { this.organizationalUnit = (ExtendedOrganizationalUnit)base.GetDataObject <ExtendedOrganizationalUnit>(this.OrganizationalUnit, this.ConfigurationSession, null, null, new LocalizedString?(Strings.ErrorManagementObjectAmbiguous(this.OrganizationalUnit.ToString()))); this.rootId = this.organizationalUnit.Id; } if (this.IncludeDomainLocalFrom != null) { this.includeDomainLocalFrom = ADForest.GetLocalForest(this.ConfigurationSession.DomainController).FindDomainByFqdn(this.IncludeDomainLocalFrom.Domain); if (this.includeDomainLocalFrom == null) { base.WriteError(new DomainNotFoundException(this.IncludeDomainLocalFrom.Domain), ErrorCategory.InvalidArgument, this.IncludeDomainLocalFrom); TaskLogger.LogExit(); return; } } if (this.Types == null || this.Types.Count == 0) { this.types = new MultiValuedProperty <SecurityPrincipalType>(); this.types.Add(SecurityPrincipalType.WellknownSecurityPrincipal); this.types.Add(SecurityPrincipalType.User); this.types.Add(SecurityPrincipalType.Computer); this.types.Add(SecurityPrincipalType.Group); } else { this.types = this.Types; } if (this.Identity != null) { this.Identity.IncludeDomainLocalFrom = this.includeDomainLocalFrom; this.Identity.Types = this.types; } base.InternalProcessRecord(); TaskLogger.LogExit(); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); base.InternalProcessRecord(); if (base.HasErrors) { return; } this.ChangeWinrmServiceSettings(); base.WriteVerbose(Strings.VerboseCheckRequiredFiles); this.CheckConfigurationFilePaths(); if (this.EnableKerberosModule) { this.InstallKerberosAuthenticationModule(); } if (!this.isWSManInstalled) { return; } base.WriteVerbose(Strings.VerboseCheckRequiredRegistryKeys); this.CheckRequiredRegistryKeys(); if (!this.isWSManInstalled) { return; } base.WriteVerbose(Strings.VerboseCheckIISConfiguration); this.CheckIISConfigurationFile(); if (this.needToRestartWSMan) { base.RestartWSManService(); } base.OpenHttpPortsOnFirewall(); if (this.DataCenterCAS) { base.EnableBasicAuthForWSMan(); } TaskLogger.LogExit(); }