PowerShell code to wait for a background process to finish before continuing on with a script

While this code was originally developed for an Exchange script, you can use it for any PowerShell script where you want to make sure some background process/service is finished before proceeding on with the rest of your script. I recently ran into a problem where a PowerShell scripted install/upgrade of Exchange 2016 server where the…

8