Through an typo in Assert-bConnectConnection ($connectVersion vs $_connectVersion) i recognized that the Stop-PSFunction dosnt't terminate the calling script when the version requirements aren't meet.
I realized that throwing an error inside the try/catch would trigger the Catch Block what wasn't supposed, so i moved the If block below the try/catch block
Although even outside the try/catch block Stop-PSFunction dosn't throw an terminating error, but throw does.
Dosn't work:
Stop-PSFFunction -Message "bConnect has not the Required Version: $MinVersion" -EnableException $true -Cmdlet $PSCmdlet
Works:
Throw "bConnect has not the Required Version: $MinVersion"
Stop-PSFFunction seems to be only working when $ErrorActionPreference is "Stop", while Throw is also terminating with the Default Value "Continue"
Through an typo in Assert-bConnectConnection ($connectVersion vs $_connectVersion) i recognized that the Stop-PSFunction dosnt't terminate the calling script when the version requirements aren't meet.
I realized that throwing an error inside the try/catch would trigger the Catch Block what wasn't supposed, so i moved the If block below the try/catch block
Although even outside the try/catch block Stop-PSFunction dosn't throw an terminating error, but throw does.
Dosn't work:
Stop-PSFFunction -Message "bConnect has not the Required Version: $MinVersion" -EnableException $true -Cmdlet $PSCmdlet
Works:Throw "bConnect has not the Required Version: $MinVersion"
Stop-PSFFunction seems to be only working when $ErrorActionPreference is "Stop", while Throw is also terminating with the Default Value "Continue"
Assert-bConnectConnection.txt