v4.1 o365 Discovery/Sync error: o365.ps1: line 45

Created: 2022-09-27 17:47:39
Modified: 2022-10-14 14:03:11
Tags: Office 365 Troubleshooting UnitySync

This error applies to UnitySync v4.x connections using o365 directory. Discovery or Sync may fail with the error shown below.

To fix this problem:

  1. Make a backup copy of \bin\o365.ps1
  2. Edit \bin\o365.ps1

  3. After this line:
    $UserCredential = new-object -typename System.Management.Automation.PSCredential -argumentlist $username,$password

    INSERT this line:

    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

  4. Save \bin\o365.ps1

Below is an example of the error as it appears in the UnitySync log:

Powershell Error | One or more errors occurred.

MyCommand : New-ExoPSSession
BoundParameters : {}
UnboundArguments : {}
ScriptLineNumber : 475 CommandOrigin : Internal DisplayScriptPosition : at Connect-ExchangeOnline
(Process), C:\ProgramFiles\WindowsPowerShell\ Modules\ExchangeOnlineManagement\2.0.4\ netFramework\ExchangeOnlineManagement.psm1: line 475 at , D:\UnitySync-v4.1.8\bin\o365.ps1: line 45

Run Summary : 09/26/22 09:38:38
Run Time | 7 seconds

Error Summary : 09/26/22 09:38:38
Powershell Error | 1

Share this article:
Knowledgebase

Directory
  1. Directify - Self Service

  2. Mimic - Replication

  3. UnitySync - Sync
Password
  1. emPass - Sync
Obsolete
  1. Profiler
  2. SimpleSync