Version: 1.5.0 (downloaded on 2026-06-05)
In my script; i got an array of assignments I wanted to add to a deployment. I just noticed that try/catch does not work for the command, as well as it exiting my loop when an error or warning occurs (meaning that not just the failed assignment is not configured but all subsequent assingments are dropped as well).
My testing showed that the "break" statement after each "Write-Warning" in the "Begin" block causes this behavior.
My suggestion here is to replace the "break" statements with "throw" to have try/catch working AND not breaking out of the loop if the function is called inside such.
Additionally, the Write-Warnings could be converted to Write-Error if they should stop the command anyway? This way, everybody could decide for themselves how to handle an error.
Best regards,
garnul
Version: 1.5.0 (downloaded on 2026-06-05)
In my script; i got an array of assignments I wanted to add to a deployment. I just noticed that try/catch does not work for the command, as well as it exiting my loop when an error or warning occurs (meaning that not just the failed assignment is not configured but all subsequent assingments are dropped as well).
My testing showed that the "break" statement after each "Write-Warning" in the "Begin" block causes this behavior.
My suggestion here is to replace the "break" statements with "throw" to have try/catch working AND not breaking out of the loop if the function is called inside such.
Additionally, the Write-Warnings could be converted to Write-Error if they should stop the command anyway? This way, everybody could decide for themselves how to handle an error.
Best regards,
garnul