File scan is really slow when Windows virus Real-time protection enabled

Hi, I have an app that loads the metadata from thousands of media files. On Windows 10 a beta tester pointed out that it takes a lot longer to perform this scan when Windows Virus “Real-time protection” is enabled.

I see the same issue myself. A scan of 5000 files takes approx 190 seconds with Windows Virus “Real-time protection” enabled and 17 seconds with it disabled. When I scan the files for a second time it takes around 14 seconds, that is with Windows Virus “Real-time protection” is enabled or not.

It’s like the Windows Virus “Real-time protection” is checking each file my app goes to read. Once it’s seen it it doesn’t need to check it again, that is until I reboot.

Does anyone have any experience with Windows Virus “Real-time protection” slowing down your app, particularly if it’s reading a lot of files? Is there any way to get around this, or even for a user to whitelist an app? Short of getting the user to disable Windows Virus “Real-time protection” each time they want to do a scan with my app I currently don’t see a way around this.

If I’m not being clear on what this Windows setting is, first go to the ‘Virus & threat protection’ setting page, click ‘Manage settings’, then on the ‘Virus & threat protection settings’ page toggle below ‘Real-time protection’.

Thanks Mark

look for “exclusions” in there. You have to add a Process exclusion, this will exclude all files opened by the specified process. (put the full exe name of your app there)

Great. This works. Many thanks. I’ll have a look to see if I can get my installer to do this automatically.

If you can, I’ll cease to trust installers in the future, because virus makers could do the same and disable the antivirus for their virus…
But no one said Microsoft took good decisions… :man_shrugging:

I found you can do it with Inno Setup:

[Run]
Filename: “powershell.exe”; Parameters: “Add-MpPreference -ExclusionProcess “MyApp.exe””; Flags: runhidden

More info here

1 Like