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(); }
protected internal virtual void InvokeCommand(Cmdlet command) { var result = command.Invoke().GetEnumerator(); result.MoveNext(); }
/// <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(); }
public static Collection <PSObject> Invoke(this Cmdlet cmdlet, string script, RunspaceMode runspaceMode = RunspaceMode.CurrentRunspace) { return(cmdlet.Invoke <PSObject>(script, runspaceMode)); }