Xeroday / Spotify-Ad-Blocker

EZBlocker - A Spotify Ad Blocker for Windows
https://www.ericzhang.me/projects/spotify-ad-blocker-ezblocker/
GNU General Public License v3.0
1.85k stars 193 forks source link

Autostart feature not working #202

Closed DerRockWolf closed 3 years ago

DerRockWolf commented 5 years ago

If you tick the checkbox "Start EZBlocker on Login" it adds the exe to startup, but after booting your pc it wont start.

Workaround from #61: In order to run EZBlocker as administrator on startup/login you have to use a scheduled task.

Simply change all the ***fields*** with your values and save the file as ezBlockerScheduleTask_RunAsAdmin.xml. Then Simply execute schtasks /create /tn "Spotify Ad-Blocker (Administrator)" /xml ezBlockerScheduleTask_RunAsAdmin.xml in a privileged (admin) shell.

<?xml version="1.0" encoding="UTF-16"?>
<!-- aso http://stackoverflow.com/a/5427746 -->
<!-- run in a privileged shell:
    schtasks /create /tn "Spotify Ad-Blocker (Administrator)" /xml ezBlockerScheduleTask_RunAsAdmin.xml-->
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2015-01-27T18:30:34</Date>
    <Author>me</Author>
  </RegistrationInfo>
  <Triggers>
    <LogonTrigger>
      <StartBoundary>2015-01-27T18:30:00</StartBoundary>
      <Enabled>true</Enabled>
    </LogonTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>***your SID***</UserId>
      <LogonType>InteractiveToken</LogonType>
      <RunLevel>HighestAvailable</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <StartWhenAvailable>false</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <IdleSettings>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>***enter path here, use quotes, e.g.: "D:\EzBlocker\EZBlocker.exe"***</Command>
    </Exec>
  </Actions>
</Task>

Code originally posted by @shadow1runner in #61