jspano
Posts: 3
Joined: Mon Jul 01, 2024 3:27 pm

add exclusion to windows defender for app dir, cant get it to work

Hi, i'm trying to do a powershell script in my installer that add the installed directory to the list of exclustions in defender.
I've seen a couple posts on here but I can't make any of it work.

please see the attached image for my script. I'm sure i'm missing something simple but I can't find it.

I tried both deferred execution as well as commit. neither worked so far.
power.png
power.png (25.11 KiB) Viewed 4338 times
it's sequenced after PublishProduct in my list
power2.png
power2.png (24.8 KiB) Viewed 4338 times
TY
Catalin
Posts: 7513
Joined: Wed Jun 13, 2018 7:49 am

Re: add exclusion to windows defender for app dir, cant get it to work

Hello,

The first mistake I can see is a typo in the variable name.

-appdr should be -appdir

If that still does not work, then another issue could be the admin rights.

You can check whether the script works without admin rights by launching a PowerShell and trying to add a random folder to the exclusion list. Preferably, the folder should be from the C:\Program Files so it matches what you try to achieve in the installation package.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jspano
Posts: 3
Joined: Mon Jul 01, 2024 3:27 pm

Re: add exclusion to windows defender for app dir, cant get it to work

Ah crap, sorry TY, i totally missed that.
works now.

Do you know what will happen if it's not ran as an admin though? If it fails for that i don't care.
i have it set to not fail if the custom actoni returns an error.
is that enough?
Catalin
Posts: 7513
Joined: Wed Jun 13, 2018 7:49 am

Re: add exclusion to windows defender for app dir, cant get it to work

Hello,

You are always welcome, glad to hear it works as expected now!

Regarding your new question, if you unchecked the option to end the setup if the custom action fails, then yes, it should be enough to not end the entire setup.

Normally, if a custom action fails, the entire setup will fail and rollback all the changes it made.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”