I made a custom Java GUI application to help some of my students perform matrix calculus (name: BCS). To have a custom icon and to minimize problems with their lack of experience with jar files, I created an exe that simply runs a bat file that opens my app (java -jar BCS.jar). Also, to minimize problems with external libraries and their path, I created a custom installer with Inno Setup. All of this worked fine on my PC, but when I tried on my lab's computer, windows defender detects a virus (?) and deletes the exe inside the created directory and its desktop shortcut.
I tried to add a piece of instruction on Inno Setup that runs a powershell script, adding a windows defender exclusion for the BCS directory.
INSIDE INNO SETUP
[Run]
Filename: "powershell.exe"; \
Parameters: "-ExecutionPolicy Bypass -File ""{app}\setup.ps1"""; \
WorkingDir: {app}; Flags: runhidden
SETUP.PS1
$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
Add-MpPreference -ExclusionPath $scriptPath
Add-MpPreference -ExclusionProcess "BCS.exe"
Doing this, the exclusion is successfully added. But after the install on my lab's computer, windows defender still detect a virus on the desktop shortcut. The exe inside BCS directory was untouched, but its shortcut was again deleted. How can I get rid of the windows defender warnings for my application, without disabling it? I suppose that if I add another exclusion to the desktop shortcut, it will be ok. But if the user wants to put the shortcut somewhere else? Any help will be appreciated. Sorry if my English is bad, it is not my first language.