I have 3 script files file1.ps1,file2.ps1,file3.ps1 to be run one after one but only if the precedence script succeeded succesfully
how can i do that, i want to wrap the 3 filoe script in one operation.
thanks in advance
How are you determining success?
I’d wrap the 3 scripts in another script and pass the success/failure details back to that.
A better approach would be to convert the 3 scripts to functions then you can have a controlling script that the functions can pass success/failure to
Agreed. It’d be far better to build the sub-scripts into functions, which your “main” script can then call. Functions can return errors (Write-Error or Throw), which the main script could trap. Functions could also just return a good/bad return value, so the mains cript would know.