I wrote a little PowerShell script that invokes different MSI files to install software. Sometimes I got the following error from Windows Installer:
Another program is being installed. Please wait until that installation is complete, and then try installing this software again.
How could I prevent this error before I invoke the MSI files? I tried to associate this with the process TrustedInstaller. I thought that the process would come up when the PC is installing something that blocks my installation. But unfortunately, sometimes my installations work fine although the process is running. Is there a definitive indication which could be caught with PS?