public void ChangePSDirectory(string directory) { if (!String.IsNullOrWhiteSpace(directory)) { Invoke("Set-Location " + PathUtility.EscapePSPath(directory), null, false); } }
// Was passing in IPackage public void ExecuteScript(string installPath, string scriptPath, ScriptPackage package) { if (File.Exists(scriptPath)) { string folderPath = Path.GetDirectoryName(scriptPath); Invoke( "$__pc_args=@(); $input|%{$__pc_args+=$_}; & " + PathUtility.EscapePSPath(scriptPath) + " $__pc_args[0] $__pc_args[1] $__pc_args[2]; Remove-Variable __pc_args -Scope 0", new object[] { installPath, folderPath, package }, outputResults: true); } }
public void ImportModule(string modulePath) { Invoke("Import-Module " + PathUtility.EscapePSPath(modulePath), null, false); }