0

I Create a Task Scheduler via GPO to do a job. I set task to stop running after 3 days and delete after 30 days, but it’s not working. Task running every day.image

  <TaskV2 clsid="{D8896631-B747-47a7-84A6-C155337F3BC8}" name="Foxit_Reader_user_regedit" image="2" changed="2017-05-23 10:49:32" uid="{60E582A9-13CA-4898-BE13-FC9F9BCA6D62}" userContext="0" removePolicy="0">
        <Properties action="U" name="Foxit_Reader_user_regedit" runAs="%LogonDomain%\%LogonUser%" logonType="InteractiveToken">
            <Task version="1.3">
                <RegistrationInfo>
                    <Author>*****\****</Author>
                    <Description></Description>
                </RegistrationInfo>
                <Principals>
                    <Principal id="Author">
                        <UserId>%LogonDomain%\%LogonUser%</UserId>
                        <LogonType>InteractiveToken</LogonType>
                        <RunLevel>HighestAvailable</RunLevel>
                    </Principal>
                </Principals>
                <Settings>
                    <IdleSettings>
                        <Duration>PT5M</Duration>
                        <WaitTimeout>PT1H</WaitTimeout>
                        <StopOnIdleEnd>false</StopOnIdleEnd>
                        <RestartOnIdle>false</RestartOnIdle>
                    </IdleSettings>
                    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
                    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
                    <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
                    <AllowHardTerminate>false</AllowHardTerminate>
                    <AllowStartOnDemand>false</AllowStartOnDemand>
                    <Enabled>true</Enabled>
                    <Hidden>false</Hidden>
                    <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
                    <Priority>7</Priority>
                    <DeleteExpiredTaskAfter>P30D</DeleteExpiredTaskAfter>
                </Settings>
                <Triggers>
                    <LogonTrigger>
                        <Enabled>true</Enabled>
                        <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
                        <StartBoundary>2017-05-04T07:11:53</StartBoundary>
                        <EndBoundary>3000-05-04T07:11:53</EndBoundary>
                    </LogonTrigger>
                </Triggers>
                <Actions Context="Author">
                    <Exec>
                        <Command>%systemroot%\regedit.exe</Command>
                        <Arguments>/s \\hoyer.local\sysvol\hoyer.local\scripts\Foxit_Reader\user.reg</Arguments>
                    </Exec>
                </Actions>
            </Task>
        </Properties>
        <Filters>
            <FilterFile bool="AND" not="1" path="C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe" type="EXISTS" folder="0"/>
            <FilterRunOnce hidden="1" not="0" bool="AND" id="{803FE6D4-0287-463B-834A-04E3B1B3D71B}"/>  </Filters></TaskV2>
1
  • Did you read the boundary end date?? – Dave May 23 '17 at 14:58
0

You have set the EndBoundary date to the year 3000; that is not 30 days from now.

4
  • Yes. i did. without a expire date, I can’t checkbox "if the task is not scheduled to run again delete it after" What I want ? I want Task Scheduler stop running after X day and be delete it after X day. Thank you for helping me :) – Hello May 24 '17 at 7:00
  • Ah, sorry, I misunderstood the question. In this case, I personally would create a second job that deletes the first one with schtasks /delete <arg> and run it once when the job is done. – bjoster May 26 '17 at 21:15
  • Date of employment are diffrenet, i have to make Task Scheduler to delete himself after x days or runs. Maybe i should make a powershell to do that ? – Hello Jun 1 '17 at 9:50
  • Yes, the script (regardless if PowerShell, batch or whatever) can remove it's entry by itself. – bjoster Jun 6 '17 at 11:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.