public async Task <List <IPowerShellCommand> > GetCommands() { var myTask = Task.Factory.StartNew(() => ExplorerExecutionHelper.ExecuteCommand <CommandInfo>("Get-Command") ); var result = await myTask; return(ConversionFactory.Convert(result)); }
public async Task <List <IPowerShellModule> > GetModules() { var myTask = Task.Factory.StartNew(() => ExplorerExecutionHelper.ExecuteCommand <PSModuleInfo>("Get-Module -ListAvailable") ); var result = await myTask; return(ConversionFactory.Convert(result)); }
public async Task <IPowerShellCommandMetadata> GetCommandMetadata(IPowerShellCommand command) { var script = string.Format("New-object System.Management.Automation.CommandMetaData -ArgumentList (Get-Command {0})", command.Name); var myTask = Task.Factory.StartNew(() => ExplorerExecutionHelper.ExecuteCommand <CommandMetadata>(script) ); var result = await myTask; var items = ConversionFactory.Convert(result); if (items.Count > 0) { return(items[0]); } return(new PowerShellCommandMetadata()); }