grahamr975 / EWS-Office365-Contact-Sync

Uses Exchange Web Services to synchronize a Global Address List in Office 365 to a user's mailbox
MIT License
94 stars 21 forks source link

Impossible to configure as a scheduled task from Windows #105

Closed Raph0773 closed 3 months ago

Raph0773 commented 4 months ago

Hello,

I'm having trouble getting the PowerShell script to work as a scheduled task. The script fails to load the module "Write-Log". I don't understand what's wrong. The script works fine when I run it manually.

Please find my schedule confiuration on my Windows Server 2016 :

Program/Script : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

Arguments : -ExecutionPolicy Bypass -File "D:\SyncContacts\Multi-Threaded.ps1" -CertificatePath "D:\SyncContacts\Getting Started\mycert.pfx" -CertificatePasswordPath "D:\SyncContacts\Getting Started\mypass.cred" -ClientID "xxxxxx-xxxxxx-xxxxxx-xxxxxx" -FolderName "Contacts" -LogPath "D:\SyncContacts\Logs" -ExcludeSharedMailboxContacts -ExcludeContactsWithoutPhoneNumber -MailboxList DIRECTORY -ExchangeOrg "xxxxxxxxx.onmicrosoft.com" -ModernAuth

Can you help me ?

Thanks