If you ever need to re-create the system standard user license batch job, this can be completed using the following lines of code, in a job.
To create the Automatical Role Assignement batch job use:
To create the user licnese miner batch job user:
When programming batch jobs you might encounter the following error message log from a failed to execute batch job:
System.InvalidCastException: Unable to cast object of type ‘<class name>’ to type ‘Dynamics.Ax.Application.Batchable’.
Batch jobs are a powerful part of DAX and should be utilized as much as possible. But there are times when you write batch job code that works fine in non-batch mode that just error when run in batch.