VM-Packages
VM-Packages copied to clipboard
exception catch in vm.common.psm1 may not be working
Details
At the beginning of packages/common.vm/tools/vm.common/vm.common.psm1, we set $ErrorActionPreference = 'Stop' and we do the same at the beginning of many packages. Isn't this causing that the catch when an exception occurs is not executed as the program immediately exits? @MalwareMechanic you introduced some of this exception handling to render errors better in the logs. Do you have more insight here?
Related: When a registry-item in the configuration fails to be added, the rest of registry items are also not added. It seems the exception is catched in VM-Apply-Configurations instead of in VM-Update-Registry-Value, which is where we would like it to be catched.
I think we need to give the error action a thought.
@mandiant/commando-vm this affects Commando-VM as well.
Yeah I have definitely noticed some inconsistencies with what would effectively be VM-Write-Log not actually writing anything to the log, so this is probably the cause. I agree we should look into this since the purpose of maintaining our own logs outside of choco was to have good and actionable info