Làm thế nào để cho chạy PowerShell Script theo lịch trình ?
Run the Synchronisation Operations by Using a Windows PowerShell Script
When you run OLSync setup, the script, StartSync.ps1, is copied to the following directory: :\Program Files\Microsoft Identity Integration Server\SourceCode\Scripts. Use this script to automate synchronisation operations with Windows PowerShell:
1. On the computer that is running Identity Lifecycle Manager FP1, click Start, click All Programs, click Windows PowerShell V2, and then click Windows PowerShell V2.
2. Navigate to :\Program Files\Microsoft Identity Integration Server\SourceCode\Scripts.
3. Run the following command.
Windows PowerShell will run each synchronisation operation and then report on the status.
All data in the Status column should say “success”. If you get errors, see Troubleshoot Outlook Live Directory Sync.
To create a scheduled task that runs the StartSync.ps1 script, run the following command.
This command creates a scheduled task that runs the StartSync.ps1 script every two hours from 8 A.M. to 8 P.M. You can change the frequency of the task by opening the StartSync.ps1 script and modifying the sc, mo, st and du parameters in the following line of code.
schtasks.exe /create /sc HOURLY /MO 2 /st 08:00:00 /du 0012:00 /tn “$taskname” /tr “$PSHOME\powershell.exe -c $($myinvocation.mycommand.definition)”
For more information about the sc, mo, st and du parameters, and how to modify Schtask.exe, see How to use Schtasks.exe to Schedule Tasks in Windows Server 2003.