Exemplo n.º 1
0
 // Token: 0x06001642 RID: 5698 RVA: 0x000539C4 File Offset: 0x00051BC4
 private bool ProxyCmdlet(CmdletProxyInfo cmdletProxyInfo)
 {
     this.proxiedObjectCount++;
     CmdletLogger.SafeSetLogger(this.context.UniqueId, RpsCmdletMetadata.ProxiedObjectCount, this.proxiedObjectCount);
     this.context.Items["Log_ProxiedObjectCount"] = this.proxiedObjectCount;
     if (cmdletProxyInfo.ConfirmationMessage != LocalizedString.Empty)
     {
         if (!this.shouldProcessHasBeenPrompted && this.context.CommandShell != null && !this.context.CommandShell.ShouldProcess(cmdletProxyInfo.ConfirmationMessage))
         {
             CmdletLogger.SafeAppendGenericInfo(this.context.UniqueId, "Proxy", "CancelAfterConfirm");
             CmdletLogger.SafeSetLogger(this.context.UniqueId, RpsCmdletMetadata.ExecutionResult, "Cancelled");
             this.context.WasCancelled = true;
             return(false);
         }
         SwitchParameter switchParameter = new SwitchParameter(false);
         if (this.ShouldRemoveConfirmParam() && this.context.InvocationInfo != null)
         {
             this.context.InvocationInfo.UserSpecifiedParameters.Remove("Confirm");
         }
         if (this.context.InvocationInfo != null)
         {
             this.context.InvocationInfo.UserSpecifiedParameters.Add("Confirm", switchParameter);
         }
     }
     using (new CmdletMonitoredScope(this.context.UniqueId, "CmdletProxyLatency", "CmdletProxyLatency", LoggerHelper.CmdletPerfMonitors))
     {
         this.ProxyCmdletExecution(cmdletProxyInfo);
     }
     this.context.Items["Log_CmdletProxyInfo"] = string.Format("Cmdlet proxied to remote server {0}, version {1}.", cmdletProxyInfo.RemoteServerFqdn, ProxyHelper.GetFriendlyVersionInformation(cmdletProxyInfo.RemoteServerVersion));
     return(true);
 }
Exemplo n.º 2
0
        // Token: 0x06001673 RID: 5747 RVA: 0x00054EB4 File Offset: 0x000530B4
        private void MarkDcDownIfNecessary(GenericEventArg <TaskErrorEventArg> e)
        {
            if (e.Data.ExceptionHandled)
            {
                return;
            }
            ADDriverContext  threadADContext  = ADSessionSettings.GetThreadADContext();
            ADServerSettings adserverSettings = (threadADContext != null) ? threadADContext.ServerSettings : null;

            if (this.context == null || adserverSettings == null)
            {
                return;
            }
            string text = null;

            for (Exception ex = e.Data.Exception; ex != null; ex = ex.InnerException)
            {
                if (ex is SuitabilityDirectoryException)
                {
                    text = ((SuitabilityDirectoryException)ex).Fqdn;
                    break;
                }
                if (ex is ServerInMMException)
                {
                    text = ((ServerInMMException)ex).Fqdn;
                    break;
                }
                if (ex is ADServerSettingsChangedException)
                {
                    ADServerSettings serverSettings = ((ADServerSettingsChangedException)ex).ServerSettings;
                    this.PersistNewServerSettings(serverSettings);
                    break;
                }
                if (ex == ex.InnerException)
                {
                    break;
                }
            }
            if (string.IsNullOrWhiteSpace(text))
            {
                return;
            }
            Fqdn fqdn;

            if (Fqdn.TryParse(text, out fqdn))
            {
                try
                {
                    adserverSettings.MarkDcDown(fqdn);
                    CmdletLogger.SafeAppendGenericInfo(this.context.UniqueId, "MarkDcDown", fqdn);
                    return;
                }
                catch (NotSupportedException)
                {
                    CmdletLogger.SafeAppendGenericInfo(this.context.UniqueId, "MarkDcDown-NotSupportedException", fqdn);
                    return;
                }
            }
            CmdletLogger.SafeAppendGenericInfo(this.context.UniqueId, "MarkDcDown-InvalidFqdn", fqdn);
        }
Exemplo n.º 3
0
        private void LogRemoveMailboxDetails(ADUser recipient)
        {
            Guid uniqueId = base.CurrentTaskContext.UniqueId;

            CmdletLogger.SafeAppendGenericInfo(uniqueId, "ExchangeGuid", recipient.ExchangeGuid.ToString());
            CmdletLogger.SafeAppendGenericInfo(uniqueId, "HomeMBD", (recipient.Database == null) ? string.Empty : recipient.Database.ToString());
        }
Exemplo n.º 4
0
 // Token: 0x06001675 RID: 5749 RVA: 0x00055040 File Offset: 0x00053240
 private void PersistNewServerSettings(ADServerSettings newServerSettings)
 {
     if (newServerSettings != null)
     {
         ADSessionSettings.ClearThreadADContext();
         LocalizedString adserverSettings;
         if (CmdletLogHelper.NeedConvertLogMessageToUS)
         {
             adserverSettings = TaskVerboseStringHelper.GetADServerSettings(this.context.InvocationInfo.CommandName, newServerSettings, CmdletLogHelper.DefaultLoggingCulture);
         }
         else
         {
             adserverSettings = TaskVerboseStringHelper.GetADServerSettings(this.context.InvocationInfo.CommandName, newServerSettings);
         }
         if (this.context.SessionState != null)
         {
             CmdletLogger.SafeAppendGenericInfo(this.context.UniqueId, "ADServerSettings-FailOver", adserverSettings);
             ExchangePropertyContainer.SetServerSettings(this.context.SessionState, newServerSettings);
         }
         else
         {
             CmdletLogger.SafeAppendGenericInfo(this.context.UniqueId, "ADServerSettings-NOTFailOver-SessionStateNull", adserverSettings);
         }
         ADSessionSettings.SetThreadADContext(new ADDriverContext(newServerSettings, ContextMode.Cmdlet));
         this.context.ServerSettingsAfterFailOver = newServerSettings;
         this.context.CommandShell.WriteWarning(DirectoryStrings.RunspaceServerSettingsChanged);
         return;
     }
     CmdletLogger.SafeAppendGenericInfo(this.context.UniqueId, "ADServerSettings-NOTFailOver-ServerSettingsNull", "NULL");
 }
Exemplo n.º 5
0
        private LocalizedString GenerateDelayInfoLogString(IBudget budget, DelayEnforcementResults info)
        {
            LocalizedString result = LocalizedString.Empty;

            if (!string.Equals(info.NotEnforcedReason, "No Delay Necessary", StringComparison.OrdinalIgnoreCase))
            {
                CmdletLogger.SafeAppendGenericInfo(this.context.UniqueId, "DelayInfo.Type", info.DelayInfo.GetType().Name);
                if (info.NotEnforcedReason != null)
                {
                    CmdletLogger.SafeAppendGenericInfo(this.context.UniqueId, "NotEnforcedReason", info.NotEnforcedReason);
                }
                if (string.Equals(info.NotEnforcedReason, "Max Delayed Threads Exceeded", StringComparison.OrdinalIgnoreCase))
                {
                    BudgetTypeSetting budgetTypeSetting = BudgetTypeSettings.Get(budget.Owner.BudgetType);
                    if (info.DelayInfo is UserQuotaDelayInfo)
                    {
                        UserQuotaDelayInfo userQuotaDelayInfo = info.DelayInfo as UserQuotaDelayInfo;
                        result = Strings.UserQuotaDelayNotEnforcedMaxThreadsExceeded((int)info.DelayInfo.Delay.TotalMilliseconds, info.DelayInfo.Required, userQuotaDelayInfo.OverBudgetException.PolicyPart, budgetTypeSetting.MaxDelayedThreads);
                    }
                    else if (info.DelayInfo is ResourceLoadDelayInfo)
                    {
                        ResourceLoadDelayInfo resourceLoadDelayInfo = info.DelayInfo as ResourceLoadDelayInfo;
                        result = Strings.ResourceLoadDelayNotEnforcedMaxThreadsExceeded((int)info.DelayInfo.Delay.TotalMilliseconds, info.DelayInfo.Required, resourceLoadDelayInfo.ResourceKey.ToString(), resourceLoadDelayInfo.ResourceLoad.ToString(), budgetTypeSetting.MaxDelayedThreads);
                    }
                    else
                    {
                        result = Strings.MicroDelayNotEnforcedMaxThreadsExceeded((int)info.DelayInfo.Delay.TotalMilliseconds, info.DelayInfo.Required, budgetTypeSetting.MaxDelayedThreads);
                    }
                }
                else
                {
                    CmdletLogger.SafeSetLogger(this.context.UniqueId, RpsCmdletMetadata.ThrottlingDelay, info.DelayedAmount.TotalMilliseconds);
                    if (info.DelayInfo is UserQuotaDelayInfo)
                    {
                        UserQuotaDelayInfo userQuotaDelayInfo2 = info.DelayInfo as UserQuotaDelayInfo;
                        result = Strings.UserQuotaDelayInfo((int)info.DelayedAmount.TotalMilliseconds, info.Enforced, (int)info.DelayInfo.Delay.TotalMilliseconds, info.DelayInfo.Required, userQuotaDelayInfo2.OverBudgetException.PolicyPart, info.NotEnforcedReason);
                    }
                    else if (info.DelayInfo is ResourceLoadDelayInfo)
                    {
                        ResourceLoadDelayInfo resourceLoadDelayInfo2 = info.DelayInfo as ResourceLoadDelayInfo;
                        result = Strings.ResourceLoadDelayInfo((int)info.DelayedAmount.TotalMilliseconds, info.Enforced, (int)info.DelayInfo.Delay.TotalMilliseconds, info.DelayInfo.Required, resourceLoadDelayInfo2.ResourceKey.ToString(), resourceLoadDelayInfo2.ResourceLoad.ToString(), info.NotEnforcedReason);
                    }
                    else
                    {
                        result = Strings.MicroDelayInfo((int)info.DelayedAmount.TotalMilliseconds, info.Enforced, (int)info.DelayInfo.Delay.TotalMilliseconds, info.DelayInfo.Required, info.NotEnforcedReason);
                    }
                }
            }
            return(result);
        }
Exemplo n.º 6
0
        internal static void LogADServerSettingsAfterCmdExecuted(Guid cmdletUniqueId, ADServerSettings serverSettings)
        {
            string        key           = "ADServerSettingsInEnd";
            StringBuilder stringBuilder = new StringBuilder();
            string        format        = "{0}:{1} ";

            if (serverSettings == null)
            {
                CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, key, "null");
                return;
            }
            stringBuilder.AppendFormat(format, RpsCmdletMetadata.ADViewEntireForest.ToString(), serverSettings.ViewEntireForest);
            if (serverSettings.RecipientViewRoot != null)
            {
                stringBuilder.AppendFormat(format, RpsCmdletMetadata.ADRecipientViewRoot.ToString(), serverSettings.RecipientViewRoot.ToCanonicalName());
            }
            if (serverSettings.ConfigurationDomainControllers != null)
            {
                stringBuilder.AppendFormat(format, RpsCmdletMetadata.ADConfigurationDomainControllers, string.Join <Fqdn>(",", serverSettings.ConfigurationDomainControllers.Values));
            }
            if (serverSettings.PreferredGlobalCatalogs != null)
            {
                stringBuilder.AppendFormat(format, RpsCmdletMetadata.ADPreferredGlobalCatalogs.ToString(), string.Join <Fqdn>(",", serverSettings.PreferredGlobalCatalogs.Values));
            }
            if (serverSettings.PreferredDomainControllers != null)
            {
                stringBuilder.AppendFormat(format, RpsCmdletMetadata.ADPreferredDomainControllers.ToString(), string.Join <Fqdn>(",", serverSettings.PreferredDomainControllers.ToArray()));
            }
            RunspaceServerSettings runspaceServerSettings = serverSettings as RunspaceServerSettings;

            if (runspaceServerSettings == null)
            {
                CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, key, stringBuilder.ToString());
                CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, "RunspaceServerSettings", "null");
                return;
            }
            if (runspaceServerSettings.UserConfigurationDomainController != null)
            {
                stringBuilder.AppendFormat(format, RpsCmdletMetadata.ADUserConfigurationDomainController.ToString(), runspaceServerSettings.UserConfigurationDomainController);
            }
            if (runspaceServerSettings.UserPreferredGlobalCatalog != null)
            {
                stringBuilder.AppendFormat(format, RpsCmdletMetadata.ADUserPreferredGlobalCatalog.ToString(), runspaceServerSettings.UserConfigurationDomainController);
            }
            if (runspaceServerSettings.UserPreferredDomainControllers != null)
            {
                stringBuilder.AppendFormat(format, RpsCmdletMetadata.ADUserPreferredDomainControllers.ToString(), string.Join <Fqdn>(",", runspaceServerSettings.UserPreferredDomainControllers.ToArray()));
            }
            CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, key, stringBuilder.ToString());
        }
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     if (this.approvalRequired)
     {
         string text = this.SubmitApprovalRequest(this.ApprovalAction);
         this.WriteApprovalRequiredWarning(text);
         string text2 = string.Format("Approval Request Message ID: {0}", text);
         base.AdditionalLogData = text2;
         CmdletLogger.SafeAppendGenericInfo(base.CurrentTaskContext.UniqueId, "DGMemberTaskBase.Log", text2);
     }
     base.InternalProcessRecord();
     TaskLogger.LogExit();
 }
Exemplo n.º 8
0
        // Token: 0x06001674 RID: 5748 RVA: 0x00054FE0 File Offset: 0x000531E0
        private void TryFailOver()
        {
            ADDriverContext  threadADContext  = ADSessionSettings.GetThreadADContext();
            ADServerSettings adserverSettings = (threadADContext != null) ? threadADContext.ServerSettings : null;

            if (adserverSettings != null && adserverSettings.IsFailoverRequired())
            {
                ADServerSettings newServerSettings;
                string           str;
                if (adserverSettings.TryFailover(out newServerSettings, out str, false))
                {
                    this.PersistNewServerSettings(newServerSettings);
                    return;
                }
                CmdletLogger.SafeAppendGenericInfo(this.context.UniqueId, "ADServerSettings-TryFailOver", "Failed - " + str);
            }
        }
Exemplo n.º 9
0
        internal static IEnumerable <PSObject> RPSProxyExecution(Guid cmdletUniqueId, PSCommand command, string serverFqn, ExchangeRunspaceConfiguration runspaceConfig, int serverVersion, bool asyncProxying, Task.TaskWarningLoggingDelegate writeWarning)
        {
            Uri uri = ProxyHelper.BuildCmdletProxyUri(serverFqn, runspaceConfig, serverVersion);
            IEnumerable <PSObject> result;

            try
            {
                RemoteConnectionInfo connectionInfo = ProxyHelper.BuildProxyWSManConnectionInfo(uri);
                ProxyPSCommand       proxyPSCommand = new ProxyPSCommand(connectionInfo, command, asyncProxying, writeWarning);
                result = proxyPSCommand.Invoke();
            }
            catch (Exception)
            {
                CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, "TargetUri", uri.ToString());
                throw;
            }
            return(result);
        }
Exemplo n.º 10
0
        internal static void LogADServerSettings(Guid cmdletUniqueId, ADServerSettings serverSettings)
        {
            if (serverSettings == null)
            {
                CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, "ADServerSettings", "null");
                return;
            }
            CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ADViewEntireForest, serverSettings.ViewEntireForest);
            if (serverSettings.RecipientViewRoot != null)
            {
                CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ADRecipientViewRoot, serverSettings.RecipientViewRoot.ToCanonicalName());
            }
            if (serverSettings.ConfigurationDomainControllers != null)
            {
                CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ADConfigurationDomainControllers, string.Join <Fqdn>(",", serverSettings.ConfigurationDomainControllers.Values));
            }
            if (serverSettings.PreferredGlobalCatalogs != null)
            {
                CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ADPreferredGlobalCatalogs, string.Join <Fqdn>(",", serverSettings.PreferredGlobalCatalogs.Values));
            }
            if (serverSettings.PreferredDomainControllers != null)
            {
                CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ADPreferredDomainControllers, string.Join <Fqdn>(",", serverSettings.PreferredDomainControllers.ToArray()));
            }
            RunspaceServerSettings runspaceServerSettings = serverSettings as RunspaceServerSettings;

            if (runspaceServerSettings == null)
            {
                CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, "RunspaceServerSettings", "null");
                return;
            }
            if (runspaceServerSettings.UserConfigurationDomainController != null)
            {
                CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ADUserConfigurationDomainController, runspaceServerSettings.UserConfigurationDomainController);
            }
            if (runspaceServerSettings.UserPreferredGlobalCatalog != null)
            {
                CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ADUserPreferredGlobalCatalog, runspaceServerSettings.UserConfigurationDomainController);
            }
            if (runspaceServerSettings.UserPreferredDomainControllers != null)
            {
                CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ADUserPreferredDomainControllers, string.Join <Fqdn>(",", runspaceServerSettings.UserPreferredDomainControllers.ToArray()));
            }
        }
Exemplo n.º 11
0
        internal static IEnumerable <PSObject> Invoke(Guid cmdletUniqueId, string pswsServiceUri, string cmdletCommand, NetworkCredential credential, NameValueCollection headersTobeAdd, TypeTable typeTable)
        {
            CommandInvocation.CheckArgumentNull("pswsServiceUri", pswsServiceUri);
            CommandInvocation.CheckArgumentNull("cmdletCommand", cmdletCommand);
            CommandInvocation.CheckArgumentNull("credential", credential);
            int             tickCount = Environment.TickCount;
            string          value;
            string          value2;
            ResponseContent responseContent = CommandInvocation.CreateRequest(pswsServiceUri, cmdletCommand, credential, headersTobeAdd, out value, out value2);

            while (responseContent.Status == ExecutionStatus.Executing)
            {
                int num = Environment.TickCount - tickCount;
                if (num > 600000)
                {
                    throw new PswsProxyException(Strings.PswsInvocationTimout(600000));
                }
                Thread.Sleep(1000);
                responseContent = CommandInvocation.ResumeRequest(pswsServiceUri, responseContent.Id, credential, headersTobeAdd, out value2);
            }
            CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, "TicksElapsed", (Environment.TickCount - tickCount).ToString());
            if (responseContent.Status == ExecutionStatus.Error)
            {
                CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, "RequestXml", value);
                CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, "ResponseXml", value2);
                StringBuilder stringBuilder = new StringBuilder();
                if (headersTobeAdd != null)
                {
                    foreach (string text in headersTobeAdd.AllKeys)
                    {
                        stringBuilder.Append(text);
                        stringBuilder.Append(':');
                        stringBuilder.Append(headersTobeAdd[text]);
                        stringBuilder.Append(' ');
                    }
                }
                CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, "RequestHeaders", stringBuilder.ToString());
                throw new PswsProxyCmdletException(responseContent.Error.Exception);
            }
            return(ObjectTransfer.GetResultObjects(responseContent.OutputXml, typeTable));
        }
Exemplo n.º 12
0
        // Token: 0x06001613 RID: 5651 RVA: 0x00052AE4 File Offset: 0x00050CE4
        private static bool ShouldProxyCmdlet(TaskContext context, string remoteServerFqdn, int remoteServerVersion)
        {
            if (string.IsNullOrWhiteSpace(remoteServerFqdn))
            {
                return(false);
            }
            if (context.ExchangeRunspaceConfig == null)
            {
                return(false);
            }
            if (ExTraceGlobals.FaultInjectionTracer.IsTraceEnabled(TraceType.FaultInjection))
            {
                bool flag = false;
                ProxyHelper.FaultInjection_ShouldForcedlyProxyCmdlet(context.ExchangeRunspaceConfig.ConfigurationSettings.OriginalConnectionUri, remoteServerFqdn, ref flag);
                if (flag)
                {
                    return(true);
                }
            }
            string localServerFqdn = TaskHelper.GetLocalServerFqdn(null);

            if (string.IsNullOrEmpty(localServerFqdn))
            {
                CmdletLogger.SafeAppendGenericError(context.UniqueId, "ShouldProxyCmdlet", "GetLocalServerFqdn returns null/empty value", false);
                return(false);
            }
            if (string.Equals(remoteServerFqdn, localServerFqdn, StringComparison.OrdinalIgnoreCase))
            {
                return(false);
            }
            if (CmdletProxy.CanServerBeProxiedTo(remoteServerVersion))
            {
                return(true);
            }
            CmdletLogger.SafeAppendGenericInfo(context.UniqueId, "ShouldProxyCmdlet", string.Format("Remote server version {0} doesn't support be proxied.", ProxyHelper.GetFriendlyVersionInformation(remoteServerVersion)));
            return(false);
        }
Exemplo n.º 13
0
 private void LogStatement(string key, string statement)
 {
     base.AdditionalLogData += string.Format("[{0}]", statement);
     CmdletLogger.SafeAppendGenericInfo(base.CurrentTaskContext.UniqueId, key, statement);
 }
Exemplo n.º 14
0
        // Token: 0x06001608 RID: 5640 RVA: 0x000524C4 File Offset: 0x000506C4
        private void CommitLog(string loggingStep)
        {
            if (!this.logPendingCommit)
            {
                return;
            }
            this.logPendingCommit = false;
            Guid cmdletUniqueId = this.context.UniqueId;

            try
            {
                CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.CmdletUniqueId, cmdletUniqueId);
                if (loggingStep != null)
                {
                    CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, "Logging", loggingStep);
                }
                CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ProcessId, Constants.ProcessId);
                CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ProcessName, Constants.ProcessName);
                CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ThreadId, Environment.CurrentManagedThreadId);
                CmdletLatencyTracker.EndInternalTracking(cmdletUniqueId, "Cmd");
                CmdletLatencyTracker.PushLatencyDetailsToLog(cmdletUniqueId, CmdletLogHelper.FuncNameToLogMetaDic, delegate(Enum metadata, double latency)
                {
                    CmdletLogger.UpdateLatency(cmdletUniqueId, metadata, latency);
                }, delegate(string funcName, string totalLatency)
                {
                    CmdletLogger.SafeAppendColumn(RpsCommonMetadata.GenericLatency, funcName, totalLatency);
                });
                long num = CmdletLatencyTracker.StopLatencyTracker(cmdletUniqueId);
                CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.TotalTime, num);
                CmdletLatencyTracker.DisposeLatencyTracker(cmdletUniqueId);
                if (!this.parametersSetInLog)
                {
                    if (this.context.InvocationInfo != null)
                    {
                        CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.Cmdlet, this.context.InvocationInfo.CommandName);
                        CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.Parameters, TaskVerboseStringHelper.FormatUserSpecifiedParameters(this.context.InvocationInfo.UserSpecifiedParameters ?? new PropertyBag()));
                    }
                    else
                    {
                        CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, "InvocationInfo", "null");
                    }
                }
                TaskUserInfo userInfo = this.context.UserInfo;
                if (userInfo != null)
                {
                    CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.TenantId, userInfo.ExecutingUserOrganizationId.GetFriendlyName());
                    CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.AuthenticatedUser, (userInfo.ExecutingWindowsLiveId != SmtpAddress.Empty) ? userInfo.ExecutingWindowsLiveId.ToString() : ((userInfo.ExecutingUserId != null && !string.IsNullOrWhiteSpace(userInfo.ExecutingUserId.Name)) ? userInfo.ExecutingUserId.Name : userInfo.ExecutingUserIdentityName));
                    CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.EffectiveOrganization, userInfo.CurrentOrganizationId.GetFriendlyName());
                }
                else
                {
                    CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, "UserInfo", "null");
                }
                if (this.context.ExchangeRunspaceConfig != null)
                {
                    CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.UserServicePlan, this.context.ExchangeRunspaceConfig.ServicePlanForLogging);
                    CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.IsAdmin, this.context.ExchangeRunspaceConfig.HasAdminRoles);
                    if (this.context.ExchangeRunspaceConfig.ConfigurationSettings != null && this.context.ExchangeRunspaceConfig.ConfigurationSettings.ClientApplication != ExchangeRunspaceConfigurationSettings.ExchangeApplication.Unknown)
                    {
                        CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.ClientApplication, this.context.ExchangeRunspaceConfig.ConfigurationSettings.ClientApplication);
                    }
                }
                else
                {
                    CmdletLogger.SafeAppendGenericInfo(cmdletUniqueId, "ExchangeRunspaceConfig", "null");
                }
                if (!CmdletLogHelper.DefaultLoggingCulture.Equals(CultureInfo.CurrentUICulture) || !CmdletLogHelper.DefaultLoggingCulture.Equals(CultureInfo.CurrentCulture))
                {
                    CmdletLogger.SafeSetLogger(cmdletUniqueId, RpsCmdletMetadata.CultureInfo, CultureInfo.CurrentUICulture + "," + CultureInfo.CurrentCulture);
                }
            }
            catch (Exception ex)
            {
                Diagnostics.LogExceptionWithTrace(Constants.CoreEventLogger, TaskEventLogConstants.Tuple_NonCrashingException, null, ExTraceGlobals.InstrumentationTracer, null, "Exception from CmdletLogger.AsyncCommit : {0}", ex);
                CmdletLogger.SafeAppendGenericError(cmdletUniqueId, "CommitLog", ex, new Func <Exception, bool>(TaskHelper.IsTaskUnhandledException));
            }
            finally
            {
                try
                {
                    CmdletLogger.SafeSetLogger(this.context.UniqueId, RpsCmdletMetadata.EndTime, DateTime.UtcNow);
                    CmdletLogger.AsyncCommit(cmdletUniqueId, true);
                    CmdletThreadStaticData.UnRegisterCmdletUniqueId(cmdletUniqueId);
                }
                catch (Exception exception)
                {
                    this.logPendingCommit = true;
                    Diagnostics.LogExceptionWithTrace(Constants.CoreEventLogger, TaskEventLogConstants.Tuple_NonCrashingException, null, ExTraceGlobals.InstrumentationTracer, null, "Exception from CmdletLogger.AsyncCommit : {0}", exception);
                }
            }
        }