
In the PowerShell ISE window, click View, Show Script Pane to ensure you can see the script pane (top, white section) and the Command Prompt Console (bottom, blue section).In the WindowsPowerShell folder create a new blank file called creds.txt.In the folder, create a new folder called WindowsPowerShell.As the logged on administrator, browse to My Documents (or Documents depending on your operating system).

Microsoft 365 global administrator credentials.Įncrypt the Microsoft 365 administrator password.PowerShell script containing the commands you want to run and which you can manually run with success in the Microsoft 365 domain.

RUN POWERSHELL FROM TASK SCHEDULER HOW TO
How to automate a Windows PowerShell script to run against a Microsoft 365 domainĭescribes how to use Task Scheduler to automate the running of a Windows PowerShell script against a Microsoft 365 domain.Īs an administrator of Microsoft® 365™ you may want to schedule a Windows® PowerShell® script to run regularly against your Microsoft 365 domain. This article details how to achieve this by creating a scheduled task to automatically log on to Microsoft 365 and run a PowerShell script. It assumes you have a working PowerShell script or PowerShell commands that you can already run manually with success.
