var arg1 = "firstArgument"; var arg2 = "secondArgument"; var cmd = "cmd.exe /c powershell.exe " + " -Command \". 'c:\\vcoScripts\\somePowershellScript.ps1' '" + arg1+ "' '" + arg2 + "' \"" + " < NUL 2>&1" //optional logging + " >>c:/vcoScripts/powershell.log 2>&1" ; var command = new Command(cmd); command.execute(true);
More information:
http://wannemacher.us/?p=346
http://communities.vmware.com/thread/271425