Defender Antivirus exclusion user variables

Craig Garland 236 Reputation points

Hi Guys,

I hope someone has an answer for this.

I am looking to exclude a folder in Defender endpoint. The issue is that I want to exclude a folder based on the login username. EG: c:\Folder\Username.

I assume that I could just you the variable %username% but it looks like this does not work. I found an article that says it is invalid, and if I run MpCmdrun -checkexclusion -path c:\Folder\Username. is not excluded.

Does anyone know how to exclude a folder based on the signed in username?



Microsoft 365
Microsoft 365
Formerly Office 365, is a line of subscription services offered by Microsoft which adds to and includes the Microsoft Office product line.
1,091 questions
{count} votes