Error Message
When running an ArcPy script as a scheduled task under a group managed service account (gMSA), the task may fail with the error:
“The Product License has not been initialized”
This applies to:
- ArcGIS Pro Licensing
- ArcPy scripts
- Windows Task Scheduler
- Group Managed Service Accounts (gMSA)
Cause
When ArcGIS Pro is authorized or configured, the license information is written to the current user’s profile (registry). A gMSA account has no ArcGIS Pro license configuration unless Pro is launched at least once under that account’s context.
As a result, when a scheduled task attempts to run a Python script that imports and uses ArcPy under a gMSA, ArcGIS Pro cannot find a valid initialized license and terminates execution.
Solution or Workaround
- Download PsTools and extract to a known path (for example: C:\PSTools).
- PsExec64.exe is needed to launch Powershell with the gMSA user account.
- Open PowerShell ISE as Administrator.
- Ensure the gMSA account is a member of the local Administrators group on the machine.
- Go to Edit Local Users and Groups > Groups > Administrators. Add the gMSA user if necessary.
- Start PowerShell ISE as an admin.
- Launch PowerShell Under the gMSA by running the following script in PowerShell ISE.
C:\PSTools\PsExec64.exe -i -u DOMAIN\gMSAAccount$ -p ~ powershell.exe
-
- This opens a new PowerShell window running as the gMSA user.
- -p ~ flag is required, as gMSAs do not have a traditional password.
- In the PowerShell window, verify the Active User Context; confirm the session is running under the gMSA account with the following command:
whoami
- From the gMSA PowerShell session, start ArcGIS Pro.
Start-Process "C:\Program Files\ArcGIS\Pro\bin\ArcGISPro.exe"
-
- If necessary, click OK in the pop-up dialog box about Microsoft Edge.
- Configure ArcGIS Pro Licensing.
- Exit the application after licensing has been successfully configured.
- Re-run the Scheduled Task: execute the scheduled task again under the gMSA account.
- The task should now run successfully without licensing errors.