logo
search
Others

How to Schedule Microsoft 365 PowerShell Scripts

Muhammad TalhaMuhammad Talha Sep 27, 2026 869 views

Question details

The user needs a method to automatically run Microsoft 365 PowerShell scripts on a regular schedule without relying on a dedicated local server.

How to Schedule Microsoft 365 PowerShell Scripts
Product
Microsoft 365
Device & OS
not provided
Scenario
Automating routine administrative tasks for SharePoint Online, OneDrive, Exchange, Microsoft Graph, and Azure AD on a daily, weekly, or monthly basis.
Observed behavior
Looking for the standard tools or cloud services capable of executing unattended PowerShell scripts at scheduled intervals.
Before you start

Ensure you have global administrator or necessary role-based access control (RBAC) privileges in your Microsoft 365 tenant, and an active Azure subscription if you plan to use cloud-based automation.

Solution 1Recommended

Use Azure Automation (Recommended)

Azure Automation is a native cloud solution that allows you to run scripts without managing any underlying server infrastructure.

Azure Automation provides a reliable, cloud-based environment for scheduling and executing PowerShell scripts (Runbooks). It integrates perfectly with Azure AD and Microsoft Graph, making it the ideal choice for serverless administrative scheduling.

1
Create an Automation Account

Log in to the Azure Portal, search for 'Automation Accounts', and click 'Create'. Fill in your resource group, region, and account name, then finalize the creation.

2
Import Modules

Navigate to 'Shared Resources' > 'Modules' within your Automation Account. Import any required Microsoft 365 modules (like ExchangeOnlineManagement or Microsoft.Graph) from the gallery.

3
Create a Runbook

Go to 'Process Automation' > 'Runbooks' and click 'Create a runbook'. Give it a name, select 'PowerShell' as the runbook type, and paste your Microsoft 365 script into the editor. Save and Publish the runbook.

4
Link to a Schedule

Under 'Shared Resources', click 'Schedules' and 'Add a schedule'. Define your daily, weekly, or monthly frequency. Finally, return to your runbook, click 'Link to schedule', and attach your newly created schedule.

Use Azure Automation (Recommended)
Authentication Tip: For unattended scripts in Azure Automation, it is highly recommended to use a Managed Identity or an Azure AD App Registration with certificate-based authentication instead of standard usernames and passwords.
Free Microsoft Office alternative

Looking for a Lightweight Office Suite Alternative?

While managing complex scripts requires Microsoft's backend infrastructure, everyday document management shouldn't be overly complicated or expensive. WPS Office provides a free, lightweight, and highly compatible alternative for handling your spreadsheets, documents, and presentations with a familiar interface.

  1. 1. Download WPS Office: Visit the official WPS Office website and click the free download button for your operating system.
  2. 2. Install the Software: Run the downloaded installer file and follow the quick setup wizard.
  3. 3. Open Your Documents: Launch WPS Office and immediately start opening or editing your existing Microsoft Office (.docx, .xlsx, .pptx) files.
Seamless compatibility with Microsoft Word, Excel, and PowerPoint formats.Lightweight installation with incredibly fast startup times.All-in-one tabbed workspace to easily manage multiple files simultaneously.Free to use for everyday administrative and personal document tasks.
microsoft office alternative - wps office

Frequently Asked Questions

Can I use Power Automate to schedule PowerShell scripts?

Yes, but indirectly. Power Automate cannot run PowerShell scripts natively. However, you can create a scheduled cloud flow in Power Automate that triggers an Azure Automation runbook via the Azure Automation connector or an HTTP webhook.

Is Azure Automation free to use for scheduling scripts?

Azure Automation offers a free tier that includes 500 minutes of job run time per month. For most standard daily or weekly administrative scripts, this free allowance is more than sufficient.

Why does my Task Scheduler script fail when my computer is locked?

Ensure you have selected 'Run whether user is logged on or not' in the task's properties. Also, verify that the saved Windows credentials are correct and that the password has not recently expired or changed.

How do I secure credentials in my scheduled PowerShell scripts?

Never store plain-text passwords in your scripts. Use Azure Managed Identities or App Registrations with client secrets/certificates when using Azure Automation. For local Task Scheduler scripts, use the Windows Credential Manager or encrypted XML credential files.