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

Created: 2022-09-27 17:47:39
Modified: 2023-08-29 16:22:37
Tags: Office 365 Troubleshooting UnitySync

UnitySync o365 connections require the latest revision of UnitySync (as of v4.5.6). Refer to this article for details.

The below solution is obsolete. Please upgrade to the latest version of 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 (ScriptBlock), 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