Run Multiple Powershell Scripts Sequentially - on a Folder - Combine Scripts into a Master Script

Viewed 63824

I have 6+ scripts and growing to run on a folder, what is the best way to have them run one after the other.

I have seen and tried this thread - it did not work unfortunately.

How to run multiple Scripts one by one in a powershell script

In a master .ps file - I have put links to the power shell scripts that need to be run in order

Run Scripts in order

'C:\Users\WP\Desktop\Scripts\1.ps1'
'C:\Users\WP\Desktop\Scripts\2.ps1'
'C:\Users\WP\Desktop\Scripts\3.ps1'

etc

This did not work either. Your help is appreciated - I have searched all over and can't seem to fix this issue.

Revised: I believe I will have to wait for each power shell script to finish before running the next one - as I have had errors when I tried to run 3 scripts one after the other - nothing happened when the scripts were run

Final -

I thank you all for your help - to keep things simple this is what I have done

My folder has the scripts below - I have then created a Master.ps1 with the code below inside it:

&"$PSScriptroot\1.ps1"
&"$PSScriptroot\2.ps1"
&"$PSScriptroot\3.ps1"
&"$PSScriptroot\4.ps1"
&"$PSScriptroot\5.ps1"
&"$PSScriptroot\6.ps1"

I have then run the Master.ps1 on the folder with all the files - and it does the job so far.

6 Answers
Related