コード例 #1
0
 public static void GetCallerPreference(this Cmdlet cmdlet)
 {
     try{
         cmdlet.Invoke("Get-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState");
     }
     catch {
         // ignored
     }
 }
コード例 #2
0
        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));
 }