Add an -async parameter to powershell.exe
Votes from Connect: 13
Original Date Submitted: 10/22/2015 8:22:53 PM
Description:
Contact Information
Handle: Kirk Munro
Site Name: PowerShell
Feedback ID: 1929427
Problem Description:
When invoking PowerShell.exe from the command line, you don't always want to wait until the process finishes before you continue performing other tasks. For example, when invoking a powershell.exe task from an event (trigger) in SQL Server. Today this requires invoking powershell.exe to run Start-Process to invoke powershell.exe in an asynchronous manner. This double-invoke is annoying and should be unnecessary.
I would like to see an additional parameter on PowerShell.exe, -async, that automatically handles the asynchronous invocation of whatever command/script you want invoked asynchronously.
e.g. Today in SQL server, I have to do this for async invocation:
xpcmdshell 'powershell.exe -noprofile -nologo -command "Start-Process -FilePath ${PSHome}\powershell.exe -ArgumentList @(''-noprofile'',''-nologo'',''-command'',{Invoke-WebRequest -Uri http://mywebservice.com/mywebmethod})"', NOOUTPUT;
It would be much easier and beneficial if that command could be invoked like this instead:
xpcmdshell 'powershell.exe -noprofile -nologo -async -command "Invoke-WebRequest -Uri http://mywebservice.com/mywebmethod"', NOOUTPUT;
Product Studio item created by Connect Synchronizer due to creation of feedback ID 1929427 (http://connect.microsoft.com/PowerShell/feedback/ViewFeedback.aspx?FeedbackID=1929427).
Repro Steps:
Internal BugId: 15910
