Follow

Running an Export from a Scheduled Task using the Kaseya Exchange Migrator

This step by step guide should walk you through configuring the mailbox export process.

Step 1

Create a PowerShell script that imports the MessageOps Migrator Powershell module and executes the export you require:

Import-Module messageops-migrator
$ExportFolderPath = "c:\temp"
#Admin Credentials
$powerUser = “user@domain.onmicrosoft.com”
$powerPass = "passowrd"
$password = ConvertTo-SecureString $powerPass -AsPlainText -Force
$creds = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $powerUser,$password
Export-MessageOps.ToPST -DestinationDirectory $BackupFolderPath -SourceMailbox user@domai.msgdevelop.onmicrosoft.com -Credential $creds –Mailbox
(save this as export.ps1)


Step 2

Create a batch file that will execute the export scripts eg
PowerShell.exe -Command ". 'c:\directory\export.ps1'
(save this as export.bat)


Step 3

Create a Basic Task to run the script in Task Scheduler

Step1.png

step2.png

Step3.png

Step4.png

Open the Task properties once your are done and make sure Run with highest privileges is selected and the task is configured for Windows 7, 2008 R2.

What if this doesn't work?

Most of the time these problems will result from the account you are trying to run the program as.

  • First you should log to the machine where you have created the Task with the account your trying to run the task as.

  • Next try to load the MessageOps-Migrator cmdlets.  Start powershell and run Import-Module messageops-migrator.  The Cmdlets get installed to the userprofile of the user that installed the Application so if you logon as another user they won't be available so you will need to either install the
    application as that user or copy the \Documents\WindowsPowerShell\Modules\MessageOps-Exchange directory from the install user to this user.

  • If that works okay try to run that Migrator as this user and ensure you don't get any licencing prompts. The Migrator stores the licencing setting in the users registry profile so if this isn't the normal user that you run the Migrator you will have to reselect the Licence file. If that all works try then running the cmd file and see if it will run okay with no prompts etc.

  • If that all works try to logon as another user and run the task manually from the Task Schedule and check the logs in the C:\Users\userName\MessageOps\ExchangeMigrator\logs of the user that task is setup to run as and see if a Log is getting created.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.