Jump to content
uniGUI Discussion Forums
Sign in to follow this  
Abaksoft

Add a Windows Defender Exclusion

Recommended Posts

Dear Unigueers;

Although it is not advisable to deploy your Unigui application on Windows 10 (always use Server editions), here is a procedure to automatically bypass the Windows Defender firewall.

Have Fun :)


procedure TForm2.Exclusion_Windows_Defender;
var MyExeFile, Folder, St:string;
begin
  MyExeFile:='"' + 'C:\Program Files (x86)\Project1.exe'  + '"';

  try

  //1. Add Exclusion Path
    St:='/K  powershell Add-MpPreference -ExclusionPath ''' + MyExeFile + '''';
    Folder:='C:\Windows\System32';

    ShellExecute(Application.Handle,           // uses ShellAPI
     'runas',
     'cmd.exe',
     PChar(St),
     Pchar(Folder),
     SW_Hide);


  //2. Add Exclusion process
    St:='/K  powershell Add-MpPreference -ExclusionProcess ''' + MyExeFile + '''';
    Folder:='C:\Windows\System32';

    ShellExecute(Application.Handle,
     'runas',
     'cmd.exe',
     PChar(St),
     Pchar(Folder),
     SW_Hide);

  finally
  end;

  // Wait fo about 5 secondes ...
  sleep(5000);

end;

 

  • Like 3

Share this post


Link to post
Share on other sites
Sign in to follow this  

×