def InvokeCommand(_cmdName, _input=None, *args, **kws):
 cmd = Command(_cmdName)
 for arg in args:
  cmd.Parameters.Add(CommandParameter(None, fix_arg(arg)))
 for (name, value) in kws.items():
  cmd.Parameters.Add(CommandParameter(name, fix_arg(value)))
 pipeline = _runspace.CreatePipeline()
 pipeline.Commands.Add(cmd)
 if _input:
  ret = pipeline.Invoke(fix_arg(_input))
 else:
  ret = pipeline.Invoke()
 return ShellOutput(ret)

def InvokeCommand ( _cmdName , _input = None , * args , ** kws ) : cmd = Command ( _cmdName ) for arg in args : cmd . Parameters . Add ( CommandParameter ( None , fix_arg ( arg ) ) ) for ( name , value ) in kws . items ( ) : cmd . Parameters . Add ( CommandParameter ( name , fix_arg ( value ) ) ) pipeline = _runspace . CreatePipeline ( ) pipeline . Commands . Add ( cmd ) if _input : ret = pipeline . Invoke ( fix_arg ( _input ) ) else : ret = pipeline . Invoke ( ) return ShellOutput ( ret )
used to actually invoke a powershell command .