I have created several ps1 scripts to install applications. When I run them manually one by one they work great both local and remote. When I try to automate all the individual scripts to run one after the other, they fail. They end up running over one another, not allowing one to finish before the next one starts.
So I thought why not take all the scripts and copy them into one ps1 file and try that. After modifying the variables the all in one script did work. However it gave me the same problem as before. The commands would start running before the previous command finished.
What I am asking is if anyone can give me a code snippet that I can use at the end or beginning of each ps1 script that will ensure that it checks and waits to ensure that no other code or application is running before it starts.
I am asking for a complete code snippet because I am like really, really, really, new to powershell as in I have only been using it for two weeks.