Upon running a script calling MS Edge browser in headless mode, a pop window with error "msedge.exe - Bad Image" appears. If you click OK, MS Edge execute fine in headless mode.
The cause for the error might be because DLP Endpoint Agent extension does not support browser startup boost in MS Edge and Google Chrome background application.
Disabling startup boost manually or via GPO shows to stop the pop window to appear.
1 - Go to edge://settings/system
2 - Locate "Startup Boost"
3 - Toggle the setting to the OFF position.
4 - Restart Microsoft Edge browser.
Review a similar pop window with another Microsoft application MSRA.exe:
https://knowledge.broadcom.com/external/article/184724/0xc0000428-bad-image-error-message-when.html