0

I faced with this error first time. System: Windows server 2019 10.0.17763 N/A Build 17763 This is new server with last WSUS updates.

I've created Windows Scheduler Task that runs powershell script. This script does application start after reboot. Scheduler runs ps1 script as domain service account. Account has local administrator rights.

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2022-08-23T11:14:12.8862128</Date>
    <Author>admin\user</Author>
    <URI>\Application AutoStart</URI>
  </RegistrationInfo>
  <Triggers>
    <BootTrigger>
      <Enabled>true</Enabled>
    </BootTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>DOMAINUSERSID</UserId>
      <LogonType>S4U</LogonType>
      <RunLevel>HighestAvailable</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</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>PT72H</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>powershell</Command>
      <Arguments>-NoProfile -ExecutionPolicy Bypass -file "D:\Application\ApplicationAutoStart.ps1"</Arguments>
    </Exec>
  </Actions>
</Task>

Every time system starts this task fails with "Task Scheduler failed to start "My" task for user "(NONE)". Additional Data: Error Value: 2147942487."

But when I run this task manually it start without problems.

I tried to start cmd as domain service account and start PowerShell script and got no problems

TylerH
  • 20,799
  • 66
  • 75
  • 101
Nickelton
  • 1
  • 1
  • Does this answer your question? [Powershell: Set a Scheduled Task to run when user isn't logged in](https://stackoverflow.com/questions/13965997/powershell-set-a-scheduled-task-to-run-when-user-isnt-logged-in) – Scepticalist Nov 24 '22 at 15:35
  • I think that's error 87, parameter incorrect? – js2010 Nov 24 '22 at 15:57

0 Answers0