Log on as a batch job

Hram Admin 170 Reputation points
2025-05-28T10:49:59.6333333+00:00

Hello!

Consider the following situation: there's the Windows Server 2022 domain with ~10 servers with OS = Windows Server 2022; the domain account named ~ task is created to run scheduled tasks on all servers, this account is assigned the Log on as a batch job user right by means of the GPO that applies to the OU with the ~10 servers.

The result: this configuration has been working flawlessly for the last ~8 months except for the one server: after rebuilding the server (in fact that was just OS reinstalling and joining to the domain) it keeps "thinking" the task account does not have the Log on as a batch job user right, although the policy does get applied correctly:

01

???

Thank you in advance,
Michael Firsov

Windows for business Windows Server User experience Other
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. MotoX80 36,291 Reputation points
    2025-05-28T21:25:30.11+00:00

    Given that your other servers are working, the most obvious reason would be that the computer account for the server isn't in the OU that you think it is, or that group policy isn't being applied for some reason.

    You might want to start by running gpresult.exe from a command prompt and see if it matches the RSOP report in mmc. You should see the policy name listed as being applied. If not, try running "gpupdate /force". The OU should also be listed.

    https://woshub.com/diagnose-group-policies-issues-with-gpresult/

    Use a different tool like access check to see if it sees the right being granted.

    https://learn.microsoft.com/en-us/sysinternals/downloads/accesschk

    accesschk.exe -a SeBatchLogonRight
    

    One thing that I noticed in your images was that the user name is just listed as "task". (Right below the "When running the task" text.) I no longer have access to an AD environment, but I would have expected that to indicate "YourDomain\task". Does this server have a local account named task?


  2. MotoX80 36,291 Reputation points
    2025-05-29T11:45:19.3333333+00:00

    Any accounts in "Deny batch logon" setting?

    Any related events in the Security event log? You may need to tweak your audit policy to capture failure events.


  3. Smith Pham 1,545 Reputation points Independent Advisor
    2025-06-25T03:30:29.81+00:00

    Dear Team,

    Based on the rsop.msc result you've provided, the GPO named Account_Task is correctly applying the "Log on as a batch job" right to the ~task account. When this happens, but the permission still doesn't work, the cause is almost always a conflicting "Deny" policy.

    Here is the straight answer for how to fix this:

    The most likely problem is that the ~task account, or a group it belongs to, is being explicitly forbidden this right by the "Deny log on as a batch job" policy, which always overrides the "Allow" policy.

    Follow these steps on the problematic server to resolve the issue:

    Step 1: Check the "Deny" Policy

    1. Open the Local Security Policy editor by running secpol.msc.

    Navigate to Local Policies > User Rights Assignment.

    Find and double-click the policy named "Deny log on as a batch job".

    Examine the list of users and groups. If you see the ~task account or a group it is a member of (like Domain Users or Authenticated Users), that is the source of your problem.

    Step 2: Fix the "Deny" Policy

    If you find an entry: The best practice is to not edit the local policy directly. Instead, find which GPO is applying this "Deny" setting.

    Run rsop.msc again, just as you did before.

      Look at the "Deny log on as a batch job" policy in the list and check its __Source GPO__.
      
         Edit that GPO in the __Group Policy Management Console__ on your domain controller to remove the conflicting account or group.
         
    

    Step 3: Force Policy Update and Reboot

    After you have removed the conflict from the GPO, run the following commands in an elevated Command Prompt on the problematic server to ensure the changes take effect immediately:

    Bash

    gpupdate /force
    shutdown /r /t 0
    

    A reboot is often necessary for user rights assignments to be fully updated and recognized by the system. After the server reboots, the Task Scheduler will recognize the permission correctly.Based on the rsop.msc result you've provided, the GPO named Account_Task is correctly applying the "Log on as a batch job" right to the ~task account. When this happens, but the permission still doesn't work, the cause is almost always a conflicting "Deny" policy.

    Here is the straight answer for how to fix this:

    The most likely problem is that the ~task account, or a group it belongs to, is being explicitly forbidden this right by the "Deny log on as a batch job" policy, which always overrides the "Allow" policy.

    Follow these steps on the problematic server to resolve the issue:

    Step 1: Check the "Deny" Policy

    Open the Local Security Policy editor by running secpol.msc.

    Navigate to Local Policies > User Rights Assignment.

    Find and double-click the policy named "Deny log on as a batch job".

    Examine the list of users and groups. If you see the ~task account or a group it is a member of (like Domain Users or Authenticated Users), that is the source of your problem.

    Step 2: Fix the "Deny" Policy

    If you find an entry: The best practice is to not edit the local policy directly. Instead, find which GPO is applying this "Deny" setting.

    Run rsop.msc again, just as you did before.

      Look at the "Deny log on as a batch job" policy in the list and check its __Source GPO__.
      
         Edit that GPO in the __Group Policy Management Console__ on your domain controller to remove the conflicting account or group.
         
    

    Step 3: Force Policy Update and Reboot

    After you have removed the conflict from the GPO, run the following commands in an elevated Command Prompt on the problematic server to ensure the changes take effect immediately:

    Bash

    gpupdate /force
    shutdown /r /t 0
    

    A reboot is often necessary for user rights assignments to be fully updated and recognized by the system. After the server reboots, the Task Scheduler will recognize the permission correctly.

    Best Regards,

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.