gmsa account - running windows tasks.

%3CLINGO-SUB%20id%3D%22lingo-sub-3250236%22%20slang%3D%22pt-BR%22%3Egmsa%20account%20-%20running%20windows%20tasks.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3250236%22%20slang%3D%22pt-BR%22%3E%3CP%3EI%20created%20a%20gmsa%20account%2C%20installed%20it%20on%20the%20server%20to%20run%20the%20scheduled%20task%20on%20windows.%3C%2FP%3E%0A%3CP%3EEnter%20the%20gmsa%20account%20as%20domain%20administrator%20and%20dhcp%20administrator%2C%20since%20the%20script%20that%20the%20task%20will%20execute%20is%20a%20task%20of%20the%20dhcp%20server.%3C%2FP%3E%0A%3CP%3EEnter%20the%20gmsa%20account%20in%20Log%20on%20as%20a%20batch%20job.%3C%2FP%3E%0A%3CP%3EEven%20so%2C%20the%20error%20occurs%20when%20executing%20the%20task%20in%20the%20task%20scheduler.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22GabrielLuiz_0-1646747827687.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F353771i876B28BB7C1A5A88%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22GabrielLuiz_0-1646747827687.png%22%20alt%3D%22GabrielLuiz_0-1646747827687.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3250236%22%20slang%3D%22pt-BR%22%3E%3CLINGO-LABEL%3EgMSA%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ewindows%20server%202012%20r2%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3255577%22%20slang%3D%22en-US%22%3ERe%3A%20gmsa%20account%20-%20running%20windows%20tasks.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3255577%22%20slang%3D%22en-US%22%3EIf%20you%20use%20a%20Start-Transcript%20c%3A%5Ctemp%5Clog.txt%20in%20the%20script%2C%20can%20you%20see%20if%20it%20even%20starts%20the%20script%20and%20why%20it%20fails%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3258472%22%20slang%3D%22en-US%22%3ERe%3A%20gmsa%20account%20-%20running%20windows%20tasks.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3258472%22%20slang%3D%22en-US%22%3EDid%20you%20manage%20to%20fix%20your%20issue%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3279452%22%20slang%3D%22pt-BR%22%3ERe%3A%20GMSA%20account%20-%20running%20windows%20tasks.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3279452%22%20slang%3D%22pt-BR%22%3ENot%20being%20able%20to%20solve%20it.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3279454%22%20slang%3D%22pt-BR%22%3ERe%3A%20GMSA%20account%20-%20running%20windows%20tasks.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3279454%22%20slang%3D%22pt-BR%22%3ECan't%20get%20fix.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3279470%22%20slang%3D%22en-US%22%3ERe%3A%20gmsa%20account%20-%20running%20windows%20tasks.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3279470%22%20slang%3D%22en-US%22%3E%3CP%3EAnd%20if%20it's%20a%20member%20directly%20of%20the%20local%20administrators%20group%3F%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3279472%22%20slang%3D%22en-US%22%3ERe%3A%20gmsa%20account%20-%20running%20windows%20tasks.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3279472%22%20slang%3D%22en-US%22%3E%3CA%20href%3D%22https%3A%2F%2Fstackoverflow.com%2Fquestions%2F62699123%2Fdeploy-gmsa-account-as-task-scheduler-user-account%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fstackoverflow.com%2Fquestions%2F62699123%2Fdeploy-gmsa-account-as-task-scheduler-user-account%3C%2FA%3E%20does%20this%20help%3F%3C%2FLINGO-BODY%3E
MVP

I created a gmsa account, installed it on the server to run the scheduled task on windows.

Enter the gmsa account as domain administrator and dhcp administrator, since the script that the task will execute is a task of the dhcp server.

Enter the gmsa account in Log on as a batch job.

Even so, the error occurs when executing the task in the task scheduler.

GabrielLuiz_0-1646747827687.png

 

 

8 Replies
If you use a Start-Transcript c:\temp\log.txt in the script, can you see if it even starts the script and why it fails?
Did you manage to fix your issue?
Não conseguir solucionar.
Can't get fix.

And if it's a member directly of the local administrators group? 

@Gabriel Luiz 

 

That error code translates to:

>net helpmsg 1385
>Logon failure: the user has not been granted the requested logon type at this computer.

 

So, even though you say you've granted that right, somehow, it's either not taking effect or not enough on its own.

 

With respect to "taking effect", use something like "gpresult /h rsop.html /scope computer" to generate and inspect the resultant set of policy. If the account is not listed in the "Log on as batch job" then you should also be able to see in that same report which group policy is overriding the method you used.

 

If it is listed then the "logon as batch job" is not enough on its own, but since there's not many others that are relevant (see the TASK_LOGON_TYPE enumeration below), it'd be unusual to encounter this.

 

If anything's missing, it'd likely be the "interactive" right, which could be the case of Domain Admins is not actually a member of the local Administrators group (if this is a member server) or Domain Admins has actually been denied certain logon types or scopes of computers (again, unlikely outside of high security environments).

 

It would be more likely that your attempt to provide the right has been overridden by something else (or simply didn't work to begin with.)

 

TASK_LOGON_TYPE (taskschd.h) - Win32 apps | Microsoft Docs

 

In any case, check the resultant set of policy to verify which accounts have which of the different kinds of logon rights.

 

Cheers,

Lain

have you added the gMSA account into the computer ?
in Powershell:
Install-ADServiceAccount -Identity "gMSA-account"