In the catch block, an exception occurred and you need to decide what to do with the exception. Currently, you are only only writing a log file, but you are not terminating the execution of code. You need to use Throw or Write-Error to re-throw the error or nest the try statement: