How to prevent "Program has stopped working" dialog when calling an .exe from Powershell How to prevent "Program has stopped working" dialog when calling an .exe from Powershell windows windows

How to prevent "Program has stopped working" dialog when calling an .exe from Powershell


I hate to do this, answering my own question, but I've found a workaround for now.

Before the loop:

# Disable WER temporarilySet-ItemProperty "HKCU:\Software\Microsoft\Windows\Windows Error Reporting" -Name DontShowUI -Value 1

After the loop:

# Reset the WER UI reg keySet-ItemProperty "HKCU:\Software\Microsoft\Windows\Windows Error Reporting" -Name DontShowUI -Value 0

This will be improved by calling this script from another script:

  • Get the current value of the key(s) to be modified
  • Change them
  • Call the script which returns control to the caller even if it crashes
  • Return the reg keys to their original value