ConfigMgr Scheduled Tasks with Service Account and PowerShell

I was struggling on a project recently to setup a scheduled task for MEMCM with a service account and PowerShell, because for some reason I was not able to access the MEMCM Objects when I was executing the task. After some research I found the solution:

First we need a Service Account (in my example for backup of Task Sequences hence the name):

Second step is to grant the service account permissions to even execute tasks on the particular server. I granted it “Log on as a batch job” permissions from the Local Security Policy Editor

The third Step is to grant the account access to MEMCM. In my case I just needed a Read-Only Analyst

And now comes the interesting part – you also need to start the MEMCM Console at least once as the service account, in order to register the account with the SMS Provider.

Shift+Right Click -> Run as Different User on the icon and enter the credentials of the Service Account:

You can close the console afterwards

Now we are ready to configure the Scheduled Task:

Go to Task Scheduler and Create a New Task

On the General Tab select a Name, the Account to Run as and uncheck the “Run with highest privileges” box (you already configured the permissions)

Select a Trigger:

Select an Action:

Action: Start a Program

Program: Powershell.exe

Add Arguments: Path to Script

Start in: Script Folder

You will be prompted to enter the password for the Service Account:

Save and Test the Scheduled Task

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *