Forum Discussion

coxygt's avatar
coxygt
Brass Contributor
Feb 05, 2026

Running Un-attended Scripts via Task Scheduler

I am trying to get some of my PS Scripts that are required regularly to run un-attended on a server using Task Scheduler.  I am aware that App Registrations seem to be the recommended way, but I am struggling to find the best way to plan and deploy a solution.

For example, one of the jobs I want to automate is a search using Exchange get-messagetracev2, I have created a service account, given the account Delegate Full Access permissions to 31 shared mailboxes I need to report on.  Basically, I need to know how many emails have been received during the previous week to each mailbox.

Generate a csv, list the mailbox, start date - end date, number of emails received, then ideally either email 3 users the report, or send a Teams notification (using Workflow Bot) to send a notification that the report is ready and the file is attached.

I must be using the least permissive method of doing this, looking for ways to achieve this with the lowest level of access and to understand the best config for the App Registration, can I use Delegate or must it be App permissions?


Thanks in advance

No RepliesBe the first to reply

Resources