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 {<code to run>}
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.
0 comments
Hide comments