Using gMSA for replacing the Task Scheduler service account?

EnterpriseArchitect 6,416 Reputation points
2024-07-17T07:06:45.8466667+00:00

What steps should I follow to change the current Task Scheduler service account from using the regular AD Account in the format of CORP\service.account to a gMSA?

When I try to change it manually by double-clicking on the task, it prompts for the password after clicking the OK button.

Windows for business | Windows Client for IT Pros | Directory services | Active Directory
Windows for business | Windows Client for IT Pros | Devices and deployment | Configure application groups
Windows for business | Windows Server | Devices and deployment | Configure application groups

Locked Question. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
Anonymous
2024-07-17T11:52:49.78+00:00

Hello EnterpriseArchitect,

Thank you for posting in Q&A forum.

Changing the service account for scheduled tasks to a Group Managed Service Account (gMSA) involves several steps to ensure a smooth transition. Here’s a detailed guide to help you with the process:

1.Ensure Environment Compatibility: Make sure your environment supports gMSAs. This typically means having a Windows Server 2012 or later domain controller.

2.Create gMSA: If not already created, a domain administrator will need to create the gMSA.

Install the gMSA on each server that will use it.

3.Grant Required Permissions: Ensure that the gMSA has the necessary permissions to run the scheduled tasks.

4.Change the Task Scheduler Service Account:

For a single task:

1.Open Task Scheduler.

2.Select the task you want to change.

3.Right-click and select "Properties".

4.Go to the “General” tab.

5.In the “Security options” section, click “Change User or Group…”

6.Enter the gMSA name in the format Domain\gMSAName$ (don’t forget the $ at the end of the gMSA name).

7.Click “OK”.

8.Click “OK” again to close the task properties.

If it prompts for a password, it indicates that Task Scheduler does not recognize the account as a gMSA. Make sure you have entered the correct name with the $ suffix.

5.Update Service Configuration (if applicable): If your task is tied to a service, update the service configuration to use the gMSA.

$serviceName = "YourServiceName" $gmsaName = "Domain\gMSAName$" Set-Service -Name $serviceName -Credential $gmsaName -StartupType Automatic

6.Verify the Changes: Ensure the task runs successfully with the new service account by manually triggering the task and checking if it completes without errors.

I hope the information above is helpful.

If you have any questions or concerns, please feel free to let us know.

Best Regards,

Daisy Zhou

============================================

If the Answer is helpful, please click "Accept Answer" and upvote it.

Was this answer helpful?

3 people found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Mukesh Agarwal 90 Reputation points
    2025-02-07T08:18:46.9033333+00:00

    You can't replace a service account with GMSA on task scheduler using GUI.

    Either you need to create a new task with the GMSA using PowerShell or use the option below to replace the existing service account on an existing task-

    schtasks /change /TN \test_gmsa_task /RU contoso\testgmsa$ /RP

    Please upvote and comment if this was beneficial for you.

    Was this answer helpful?

    20+ people found this answer helpful.
  2. Peter O'Reilly 0 Reputation points
    2026-11-25T11:18:10.2833333+00:00

    Pre-requisites

    • The GMSA must be configured in AD for your server, use below to confirm
    $gmsaSam = 'gmsa_account_name_here'
    $gmsaPrinc = get-adserviceaccount $gmsaSam -prop PrincipalsAllowedToRetrieveManagedPassword
    $gmsaGrp = get-adgroup -Filter * | ?{$_.DistinguishedName -like $gmsaPrinc.PrincipalsAllowedToRetrieveManagedPassword}
    $gmsaMembers = get-adgroupmember $gmsaGrp 
    
    $gmsaMembers | Select name
    

    The UI in Computer Management is a little non linear/intuitive for this but you can easily achieve it with the steps below

    Right click on the task

    • Change User or Group
    • Locations -> Select: Entire Directory
    • Object Types -> Check only: Service accounts
    • Paste in your GMSA (no $ sign) to the search box and Check Names

    Was this answer helpful?

    0 comments No comments