I\'ve been looking for a way to terminate a PowerShell (PS1) script when an unrecoverable error occurs within a function. For example:
function foo() { #
I think you are looking for Return instead of Break. Break is typically used for loops and only breaks from the innermost code block. Use Return to exit a function or script.
Return
Break