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
98 stars 21 forks source link

Scripts Exceptions in Catch and Get-GALContacts #93

Closed dhESUK closed 5 months ago

dhESUK commented 1 year ago

Experiencing the following errors when executing the sync command.

VERBOSE: Removing the imported "Write-Log" function.
VERBOSE: Loading module from path 'C:\O365ContactsSync\EWS-Office365-Contact-Sync-master\EWSContacts\Module\ExchangeContacts.psm1'.
Exception calling "Create" with "1" argument(s): "At line:67 char:5
+             } else {
+              ~
The Try statement is missing its Catch or Finally block.
At line:105 char:4
+     } catch {
+       ~~~~~
Unexpected token 'catch' in expression or statement."
At C:\O365ContactsSync\EWS-Office365-Contact-Sync-master\EWSContacts\Module\ExchangeContacts.psm1:12 char:9
+     else { $ExecutionContext.InvokeCommand.InvokeScript($false, ([scr ...
+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ParseException

It then finally craps out with the following:

C:\O365ContactsSync\EWS-Office365-Contact-Sync-master\EWSContactSync.ps1 : The term 'Get-GALContacts' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ .\EWSContactSync.ps1 -CertificatePath "c:\temp\mycert.pfx" -Certifica ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-GALContacts:String) [EWSContactSync.ps1], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,EWSContactSync.ps1

Worked with a previous version, however it stopped working a week or so ago so have replaced all the scripts with the latest ones from this repo and updated Exchange Online Powershell V3.2.0

grahamr975 commented 1 year ago

It looks like the module import is failing for you. "The term 'Get-GALContacts' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."

What version of powershell are you using?

grahamr975 commented 5 months ago

Closing to lack of reply...