Trigger Action from PowerShell Without Waiting for It to Complete

Call an action from PowerShell without waiting for its completion.

John Savill

January 13, 2015

1 Min Read
QA

Q: I want to trigger something from my PowerShell script but not wait for it to finish nor have it connected to the ongoing connection of my script; how can I do this?

A: There are a number of ways to achieve this; however, the easiest method is probably to use the Start-Job cmdlet and pass a script block of what you want to run; for example:

Start-Job -ScriptBlock {}

Other options including running a task asynchronously with BeginInvoke and EndInvoke; however, if the parent PowerShell process dies, then the called process would also die.

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like