none
Group Managemed Service Account in scheduled task with Trigger as repeat RRS feed

  • Question

  • Hi

    I have a problem I dont know how to solve.
    I have created a gMSA account for some scheduled tasks to run on Windows 2012

    I can successfully create a standard scheduled task to run anything and put in the MSA account with this PS commands:
    $principal = New-ScheduledTaskPrincipal-UserID domain\TestMSA$ -LogonType Password -RunLevel Highest
    Set-ScheduledTask -Taskname TestTask -Principal $principal
    This runs fine.

    When I reopen the scheduled task goes to trigger and enable "Repeat task every:" 15 minues for a duration of Indefinitely
    I save it as another account and redo the PS scripts to put in the domain\TestMSA$ account

    This wont work.
    It says:
    Task Scheduler failed to start "\TestTask" task for user "domain\TestMSA$". Additional Data: Error Value: 2147942402.

    If I remove the Repeat under trigger and rerun the PS script again it works fine.
    So my question is, why wont the MSA account work with repeat under trigger?

    Best regards
    Jesper
    Tuesday, August 13, 2013 1:03 PM

All replies

  • Hi. You know, i have same problem, but in my case the problem occur when i enable "Stop task if it runs longer than:" in trigger's Advanced settings. I noticed, that both this options occur this problem. I have no idea how to fix it, but i keep trying)

    Regards.

    Roman Prosvetov.

    Thursday, August 15, 2013 7:49 AM
  • Hi,

    Based on my research, you should be able to manually execute the task (to test it).  Otherwise, you cannot use the gui to edit the task.  Changes have to be made using PowerShell cmdlets.

    Quote from:

    http://blogs.technet.com/b/askpfeplat/archive/2012/12/17/windows-server-2012-group-managed-service-accounts.aspx

    Regards,

    Yan Li


    Cataleya Li
    TechNet Community Support

    Thursday, August 15, 2013 12:40 PM
    Moderator
  • You can edit the task using the gui, but when you save it you need to put in another credentials. Afterwards you can change the user back to the MSA account using the 2 powershell commands I mensioned in my first post.

    I can only execute it manually if I use another domain account than a MSA account, except if I remove the repeat feature.

    Friday, August 16, 2013 6:23 AM
  • Hi

    I created my test task via gui and then just use cmdlet's New-ScheduledTaskPrincipal & Set-ScheduledTask to modify user and everything worked fine, until i enable "Stop task if it runs longer than:" in a trigger advanced settings. And i always run it manually to test it.

    I read it all before i post here. Firstly, when i figure out this problem, i tryed to create trigger via PowerShell. But cmdlet New-ScheduledTaskTrigger doesn't have parameters to set "Stop task if it runs longer than:" in trigger. Besides, you can't set "Repeat task every:" via PowerShell, if you create "-Daily" trigger.

     If you create via gui new trigger which will be started once (not daily) and enable  "Repeat task every:" - it will work with gMSA. But if you change "Once" on "Daily" - it will not work.

    Regards.

    Roman Prosvetov

    Friday, August 16, 2013 6:40 AM
  • Yes that is correct I have also noticed that if I use "Once" and repeat is enabed it works, but for one of my tasks I want it with daily so it only runs kl. 8,10,12,14,16 and 18.

    I dont think the gMGA account is working as design on the scheduled tasks if you cant set up your tasks as you want it to be.

    Monday, August 19, 2013 9:20 AM
  • This is still an issue.  Are there any plans to update the Task Scheduler GUI to allow gMSA or at the very least allow daily/weekly/monthly triggers to work with gMSA?

    I can confirm that unchecking the box for "Stop task if it runs longer than:" seems to allow the triggers to work, but that seems kind of dangerous if the task ends up hanging...

    • Edited by xer0status Wednesday, September 23, 2015 2:04 PM
    Wednesday, September 23, 2015 1:16 PM
  • I thought I'd include my experiences with creating GMSA run scheduled tasks via XML import

    I tried exporting a GMSA scheduled task to XML and re-importing it after modifying using command line:

    schtasks.exe /Create /XML c:\temp\Test.xml /tn Test

    If the <Repetition> block is included, the task fails when being run with the run result 0x80070002.  This error appears to be "The system cannot find the file specified"

    If I remove the <Repetition> block, and import the task again, the task runs successfully

    Wednesday, May 25, 2016 7:37 AM
  • Was there ever a solution to being able to run a Scheduled Task under with "Repeat task every:" option enabled and running under the context of a gMSA account?  It would be really great to have this functioning.

    Tristan

    Tuesday, March 28, 2017 5:43 PM