This topic contains 1 reply, has 2 voices, and was last updated by
July 19, 2019 at 1:03 am #166825ParticipantTopics: 1Replies: 0Points: -8Rank: Member
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.
Thanks in advances
July 19, 2019 at 3:46 am #166867Senior ModeratorTopics: 8Replies: 1079Points: 3,621Rank: Community Hero
Going back your initial approach, how are you executing those scripts ? There are ways to wait for a program to complete before another starts in PowerShell.
Before all, If PowerShell is required for you at work, it's a must to learn it and there are lots of resources for that. some important links below.
Book: Learn PowerShell in a Month of Lunches (By Don Jones , is the best ever book to start PowerShell)
You must be logged in to reply to this topic.