public override PSPrimitiveDictionary GetApplicationPrivateData(PSSenderInfo senderInfo) { if (!Constants.IsPowerShellWebService) { ExchangeAuthorizationPlugin.InitializeAuthZPluginForRemotePS(senderInfo.ConnectionString); } ExchangeAuthorizationPlugin.EnsureSettingOverrideSyncIsStarted(); return(AuthZLogHelper.StartAndEndLoging <PSPrimitiveDictionary>("GetApplicationPrivateData", () => AuthZLogHelper.ExecuteWSManPluginAPI <PSPrimitiveDictionary>("GetApplicationPrivateData", true, true, null, delegate() { InitialSessionState initialSessionStateCore = this.GetInitialSessionStateCore(senderInfo); if (!Constants.IsPowerShellWebService) { this.CheckSessionOverBudget(); } this.currentUserISS.Target = initialSessionStateCore; int value = InitialSessionStateBuilder.CalculateHashForImplicitRemoting(initialSessionStateCore); PSPrimitiveDictionary psprimitiveDictionary = new PSPrimitiveDictionary(); psprimitiveDictionary.Add("ImplicitRemoting", new PSPrimitiveDictionary { { "Hash", value } }); if (!Constants.IsPowerShellWebService) { psprimitiveDictionary.Add("SupportedVersions", this.ExpandVersions(senderInfo.ConnectionString)); } this.LogCommonValues(); return psprimitiveDictionary; }))); }
protected void VerifyCmdletEntry(string cmdletName, string snapinName, string[] parameters) { if (snapinName.StartsWith("Microsoft.Exchange.Management.PowerShell.E2010", StringComparison.OrdinalIgnoreCase)) { base.WriteError(new ArgumentException(Strings.ExchangeCmdletsNotAllowedInRole(RoleType.UnScoped.ToString())), ErrorCategory.InvalidArgument, this.DataObject.Id); } InitialSessionStateBuilder.InitializeWellKnownSnapinsIfNeeded(); SessionStateCommandEntryWithMetadata cmdletEntry = InitialSessionStateBuilder.GetCmdletEntry(new CmdletRoleEntry(cmdletName, snapinName, parameters)); if (cmdletEntry == null || cmdletEntry.SessionStateCommandEntry.CommandType != CommandTypes.Cmdlet) { base.WriteError(new ArgumentException(Strings.CannotFindCmdletInSnapin(cmdletName, snapinName)), ErrorCategory.InvalidData, this.DataObject.Id); } this.VerifyParametersWithMetadata(cmdletEntry.CommandMetadata, parameters); }