Skip to content

Instantly share code, notes, and snippets.

@Katzenwerfer
Last active January 7, 2023 20:43
Show Gist options
  • Save Katzenwerfer/cd8cdd999403e0e3ebd102b805ac2391 to your computer and use it in GitHub Desktop.
Save Katzenwerfer/cd8cdd999403e0e3ebd102b805ac2391 to your computer and use it in GitHub Desktop.
A task that kills the EABackgroundService process when the launcher is fully closed
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Author>Katzenwerfer</Author>
<Description>Kills the EABackgroundService process after the launcher finishes its exit process.</Description>
<URI>\Katzenwerfer\Kill_EABackgroundService</URI>
</RegistrationInfo>
<Triggers>
<EventTrigger>
<Enabled>true</Enabled>
<Subscription>&lt;QueryList&gt;&lt;Query Id="0" Path="Security"&gt;&lt;Select Path="Security"&gt;*[System[Provider[@Name='Microsoft-Windows-Security-Auditing'] and Task = 13313 and (EventID=4689)]] and *[EventData[Data[@Name='ProcessName'] and (Data='C:\Program Files\Electronic Arts\EA Desktop\EA Desktop\EADesktop.exe')]]
&lt;/Select&gt;&lt;/Query&gt;&lt;/QueryList&gt;</Subscription>
</EventTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<LogonType>S4U</LogonType>
<RunLevel>HighestAvailable</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>StopExisting</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>true</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>false</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
<UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT1H</ExecutionTimeLimit>
<Priority>7</Priority>
<RestartOnFailure>
<Interval>PT1M</Interval>
<Count>5</Count>
</RestartOnFailure>
</Settings>
<Actions Context="Author">
<Exec>
<Command>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe</Command>
<Arguments>-NoLogo -NoProfile -NonInteractive -WindowStyle Hidden -Command "Stop-Process -Name 'EABackgroundService' -Force"</Arguments>
<WorkingDirectory>C:/</WorkingDirectory>
</Exec>
</Actions>
</Task>
@Katzenwerfer
Copy link
Author

If you want the PowerShell window to be completely hidden, you need to configure the task to Run wheter the user is logged on or not.
If you'd like, you can tick the Do not store password property. It will still run just fine.

@Katzenwerfer
Copy link
Author

Katzenwerfer commented Jan 7, 2023

Do note that you need to enable the Audit process tracking policy for it to work.
It should be located in \Local Computer Policy\Computer Policy\Windows Settings\Security Settings\Audit Policy\

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment