How to Schedule PowerShell Script

We create PoweShell script to perform specific activity such as Getting mailboxes count , Exchange Database size or Free disk space in the servers.

We used to manually run this script to get output results.

Is it possible to run such script automatically in the schedule time ?

Yes , It is possible , it just need some more steps … .

I will outline here …

Step1 : Create PowerShell with your requirements.

Step 2 : Create Windows Batch file to run this PowerShell script.

  1. Open the Notepad and type the below lines

    Powershell -command “&{<Your powershell script path>}”

    Example :

    Powershell -command “&{C:\Scripts\DB-Report\DB-Report-Automate.ps1}”

  1. Save the Notepad as *.Bat file
  1. Schedule the Batch file to run automatically using windows Task Scheduler.