No announcement yet.

How do i create a scheduled task to run an Exchange PowerShell task

  • Filter
  • Time
  • Show
Clear All
new posts

  • How do i create a scheduled task to run an Exchange PowerShell task

    Hi everyone,
    I have done many google searches for this answer, but i am stumped. We are have a very large mailbox database (approaching 500GB). Well, after our storage failure last week, and the 30+ hours it took to restore everything, it dawned on us, that we probably should have this database broken down into more manageable pieces. So, i am in the process of migrating users to new databases, and setting up SCR etc. I have a listing together that includes what databases users are going to etc, but it is a very manual process. My question is, how would I run the following command as a scheduled task on the mailbox server:

    ./movemailboxes.ps1 aliases.csv -TargetDatabase "ssv-mailboxes\engineering\engineering"
    I know that i can schedule a regular PowerShell task to run from a ScheduledTask by using a bat/cmd file with the syntax:
    powershell.exe -command XXXXX.ps1
    And i know that i am supposed to need the following line of code to load the exchange portion of powershell into the standard PS console
    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin
    but I can't seem to put them together to work properly.

    Any assistance would be greatly apprecaited.