コード例 #1
0
 internal static void ShouldRun(
     ExecutionContext context,
     PSHost host,
     CommandInfo commandInfo,
     CommandOrigin commandOrigin)
 {
     try
     {
         if (commandOrigin == CommandOrigin.Runspace && commandInfo.Visibility != SessionStateEntryVisibility.Public)
         {
             CommandNotFoundException notFoundException = new CommandNotFoundException(commandInfo.Name, (Exception)null, "CommandNotFoundException", new object[0]);
             CommandDiscovery.tracer.TraceException((Exception)notFoundException);
             throw notFoundException;
         }
         context.AuthorizationManager.ShouldRunInternal(commandInfo, commandOrigin, host);
     }
     catch (PSSecurityException ex)
     {
         CommandDiscovery.tracer.TraceException((Exception)ex);
         MshLog.LogCommandHealthEvent(context, (Exception)ex, Severity.Warning);
         MshLog.LogCommandLifecycleEvent(context, CommandState.Terminated, commandInfo.Name);
         throw;
     }
 }