// Token: 0x06001645 RID: 5701 RVA: 0x00053FB0 File Offset: 0x000521B0 private PSCommand GenerateProxyCmdlet(CmdletProxyInfo.ChangeCmdletProxyParametersDelegate changeCmdletProxyParameters) { this.MakeNecessaryChangeOnParametersBeforeProxy(changeCmdletProxyParameters); PSCommand pscommand = new PSCommand(); Command command = null; if (this.context.InvocationInfo != null) { command = new Command(this.context.InvocationInfo.CommandName); } if (this.context.InvocationInfo != null) { foreach (object obj in this.context.InvocationInfo.UserSpecifiedParameters.Keys) { string text = (string)obj; command.Parameters.Add(text, ProxyHelper.TranslateCmdletProxyParameter(this.GetParameterValueToProxy(text), ExchangeRunspaceConfigurationSettings.ProxyMethod.RPS)); } } pscommand.AddCommand(command); return(pscommand); }
// Token: 0x06001616 RID: 5654 RVA: 0x00052BB1 File Offset: 0x00050DB1 public CmdletProxyInfo(string remoteServerFqdn, int remoteServerVersion, bool shouldAsyncProxy, LocalizedString confirmationMessage, CmdletProxyInfo.ChangeCmdletProxyParametersDelegate changeCmdletProxyParameters) { this.RemoteServerFqdn = remoteServerFqdn; this.RemoteServerVersion = remoteServerVersion; this.ShouldAsyncProxy = shouldAsyncProxy; this.ConfirmationMessage = confirmationMessage; this.ChangeCmdletProxyParameters = changeCmdletProxyParameters; }
// Token: 0x06001644 RID: 5700 RVA: 0x00053BE8 File Offset: 0x00051DE8 private void ProxyCmdletExecution(CmdletProxyInfo cmdletProxyInfo) { ExAssert.RetailAssert(this.context.ExchangeRunspaceConfig != null, "this.context.ExchangeRunspaceConfig should not be null."); string remoteServerFqdn = cmdletProxyInfo.RemoteServerFqdn; int remoteServerVersion = cmdletProxyInfo.RemoteServerVersion; string friendlyVersionInformation = ProxyHelper.GetFriendlyVersionInformation(remoteServerVersion); CmdletProxyInfo.ChangeCmdletProxyParametersDelegate changeCmdletProxyParameters = cmdletProxyInfo.ChangeCmdletProxyParameters; if (Microsoft.Exchange.Diagnostics.Components.Tasks.ExTraceGlobals.FaultInjectionTracer.IsTraceEnabled(TraceType.FaultInjection)) { Microsoft.Exchange.Diagnostics.Components.Tasks.ExTraceGlobals.FaultInjectionTracer.TraceTest <string>(3720752445U, ref remoteServerFqdn); UserToken userToken = this.context.ExchangeRunspaceConfig.ConfigurationSettings.UserToken; ProxyHelper.FaultInjection_UserSid(ref userToken); Microsoft.Exchange.Diagnostics.Components.Tasks.ExTraceGlobals.FaultInjectionTracer.TraceTest <int>(3452316989U, ref remoteServerVersion); } string text = this.GeneratePswsProxyCmdlet(changeCmdletProxyParameters); ExchangeRunspaceConfigurationSettings.ProxyMethod proxyMethod = this.DetermineProxyMethod(remoteServerVersion); if (this.context.CommandShell != null) { this.context.CommandShell.WriteVerbose(Strings.VerboseCmdletProxiedToAnotherServer(text, remoteServerFqdn, friendlyVersionInformation, proxyMethod.ToString())); } Guid uniqueId = this.context.UniqueId; CmdletLogger.SafeAppendColumn(uniqueId, RpsCmdletMetadata.CmdletProxyRemoteServer, this.proxiedObjectCount.ToString(), remoteServerFqdn); CmdletLogger.SafeAppendColumn(uniqueId, RpsCmdletMetadata.CmdletProxyRemoteServerVersion, this.proxiedObjectCount.ToString(), friendlyVersionInformation.ToString()); CmdletLogger.SafeAppendColumn(uniqueId, RpsCmdletMetadata.CmdletProxyMethod, this.proxiedObjectCount.ToString(), proxyMethod.ToString()); try { IEnumerable <PSObject> enumerable; if (proxyMethod == ExchangeRunspaceConfigurationSettings.ProxyMethod.RPS) { PSCommand command = this.GenerateProxyCmdlet(changeCmdletProxyParameters); Task.TaskWarningLoggingDelegate writeWarning = null; if (this.context.CommandShell != null) { writeWarning = new Task.TaskWarningLoggingDelegate(this.context.CommandShell.WriteWarning); } enumerable = ProxyHelper.RPSProxyExecution(this.context.UniqueId, command, remoteServerFqdn, this.context.ExchangeRunspaceConfig, remoteServerVersion, cmdletProxyInfo.ShouldAsyncProxy, writeWarning); } else { enumerable = CommandInvocation.Invoke(this.context.UniqueId, ProxyHelper.GetPSWSProxySiteUri(remoteServerFqdn), text, CredentialCache.DefaultNetworkCredentials, ProxyHelper.GetPSWSProxyRequestHeaders(this.context.ExchangeRunspaceConfig), this.context.ExchangeRunspaceConfig.TypeTable); } foreach (PSObject psobject in enumerable) { object sendToPipeline = psobject; if (psobject.BaseObject != null && !(psobject.BaseObject is PSCustomObject)) { sendToPipeline = psobject.BaseObject; } else if (this.context.ExchangeRunspaceConfig != null) { if (this.context.ExchangeRunspaceConfig.ConfigurationSettings.ClientApplication != ExchangeRunspaceConfigurationSettings.ExchangeApplication.ECP) { if (this.context.ExchangeRunspaceConfig.ConfigurationSettings.ClientApplication != ExchangeRunspaceConfigurationSettings.ExchangeApplication.OSP) { goto IL_2CB; } } try { Task.TaskVerboseLoggingDelegate writeVerbose = null; if (this.context.CommandShell != null) { writeVerbose = new Task.TaskVerboseLoggingDelegate(this.context.CommandShell.WriteWarning); } sendToPipeline = ProxyHelper.ConvertPSObjectToOriginalType(psobject, remoteServerVersion, writeVerbose); } catch (Exception ex) { CmdletLogger.SafeAppendGenericError(uniqueId, "ConvertPSObjectToOriginalTyp", ex, new Func <Exception, bool>(TaskHelper.IsTaskUnhandledException)); Diagnostics.ReportException(ex, Constants.CoreEventLogger, TaskEventLogConstants.Tuple_UnhandledException, null, null, Microsoft.Exchange.Diagnostics.Components.Configuration.Core.ExTraceGlobals.InstrumentationTracer, "Exception from ProxyHelper.ConvertPSObjectToOriginalType : {0}"); } } IL_2CB: if (this.context.CommandShell != null) { this.context.CommandShell.WriteObject(sendToPipeline); } } } catch (Exception ex2) { CmdletLogger.SafeAppendGenericError(this.context.UniqueId, "ProxyCmdletExecution", ex2, new Func <Exception, bool>(TaskHelper.IsTaskUnhandledException)); if (this.context.CommandShell != null) { this.context.CommandShell.WriteError(new CmdletProxyException(text, remoteServerFqdn, friendlyVersionInformation, proxyMethod.ToString(), ex2.Message), ExchangeErrorCategory.ServerOperation, null); } } }
// Token: 0x06001610 RID: 5648 RVA: 0x00052A0B File Offset: 0x00050C0B public static bool TryToProxyOutputObject(ICmdletProxyable cmdletProxyableObject, TaskContext context, string remoteServerFqdn, int remoteServerVersion, bool shouldAsyncProxy, LocalizedString confirmationMessage, CmdletProxyInfo.ChangeCmdletProxyParametersDelegate changeCmdletProxyParameters) { if (CmdletProxy.ShouldProxyCmdlet(context, remoteServerFqdn, remoteServerVersion)) { cmdletProxyableObject.SetProxyInfo(new CmdletProxyInfo(remoteServerFqdn, remoteServerVersion, shouldAsyncProxy, confirmationMessage, changeCmdletProxyParameters)); return(true); } return(false); }
// Token: 0x0600160F RID: 5647 RVA: 0x000529D0 File Offset: 0x00050BD0 public static bool TryToProxyOutputObject(ICmdletProxyable cmdletProxyableObject, TaskContext context, ADUser user, bool shouldAsyncProxy, LocalizedString confirmationMessage, CmdletProxyInfo.ChangeCmdletProxyParametersDelegate changeCmdletProxyParameters) { if (user == null) { return(false); } int remoteServerVersion; string remoteServerForADUser = TaskHelper.GetRemoteServerForADUser(user, new Task.TaskVerboseLoggingDelegate(context.CommandShell.WriteVerbose), out remoteServerVersion); return(CmdletProxy.TryToProxyOutputObject(cmdletProxyableObject, context, remoteServerForADUser, remoteServerVersion, shouldAsyncProxy, confirmationMessage, changeCmdletProxyParameters)); }
// Token: 0x0600160E RID: 5646 RVA: 0x000529B0 File Offset: 0x00050BB0 public static void ThrowExceptionIfProxyIsNeeded(TaskContext context, string remoteServerFqdn, int remoteServerVersion, bool shouldAsyncProxy, LocalizedString confirmationMessage, CmdletProxyInfo.ChangeCmdletProxyParametersDelegate changeCmdletProxyParameters) { if (CmdletProxy.ShouldProxyCmdlet(context, remoteServerFqdn, remoteServerVersion)) { throw new CmdletNeedsProxyException(new CmdletProxyInfo(remoteServerFqdn, remoteServerVersion, shouldAsyncProxy, confirmationMessage, changeCmdletProxyParameters)); } }
// Token: 0x0600160D RID: 5645 RVA: 0x00052978 File Offset: 0x00050B78 public static void ThrowExceptionIfProxyIsNeeded(TaskContext context, ADUser user, bool shouldAsyncProxy, LocalizedString confirmationMessage, CmdletProxyInfo.ChangeCmdletProxyParametersDelegate changeCmdletProxyParameters) { if (user == null) { return; } int remoteServerVersion; string remoteServerForADUser = TaskHelper.GetRemoteServerForADUser(user, new Task.TaskVerboseLoggingDelegate(context.CommandShell.WriteVerbose), out remoteServerVersion); CmdletProxy.ThrowExceptionIfProxyIsNeeded(context, remoteServerForADUser, remoteServerVersion, shouldAsyncProxy, confirmationMessage, changeCmdletProxyParameters); }