I have several powershell script that I use to setup an test environment, to speed things up I put them all in a bat file. Everything is fine as long as each script completes with out error. Right now each script can detect if there is a problem and post an error code, that I can pipe to a file. I can also have the script exit, but the next script in the bat file will run. Does anyone know of a way to make the powershell script exit out of the bat file (so that the next script does not run)?
Me... I'd have written each "PowerShell script" as a function. Then have one script that just calls the functions. Within each function, if there's a problem, throw an error. That'll raise to the calling script and, if it doesn't Catch the error, make it bomb out.
Or, I mean, do the same thing but keep it all in PowerShell. Same basic effect. When you call a script, if it throws an error and you don't handle it, you bomb.