예제 #1
0
 public static void GetCallerPreference(this Cmdlet cmdlet)
 {
     try{
         cmdlet.Invoke("Get-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState");
     }
     catch {
         // ignored
     }
 }
        protected internal virtual void InvokeCommand(Cmdlet command)
        {
            if (command == null)
            {
                throw new ArgumentNullException(nameof(command));
            }

            var result = command.Invoke().GetEnumerator();

            result.MoveNext();
        }
예제 #3
0
        protected internal virtual void InvokeCommand(Cmdlet command)
        {
            var result = command.Invoke().GetEnumerator();

            result.MoveNext();
        }
예제 #4
0
 /// <summary>
 /// Invokes the command immediately.
 /// </summary>
 /// <param name="cmd">The command.</param>
 public static void InvokeImmediate(this Cmdlet cmd)
 {
     // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
     cmd.Invoke <object>().ToArray();
 }
예제 #5
0
 public static Collection <PSObject> Invoke(this Cmdlet cmdlet, string script, RunspaceMode runspaceMode = RunspaceMode.CurrentRunspace)
 {
     return(cmdlet.Invoke <PSObject>(script, runspaceMode));
 }