Hi All,
As the title suggest, I am having a bit of an issue with our Hybrid Exchange environment which is a Exchange 2013 to EXO set up, we managed to get the Public Folders synced and visible/available to the EXO users, but we are having a hard time with the Mail Enabled Public Folders sync.
We attempted to follow this article from Microsoft in order to achieve this: https://video2.skills-academy.com/en-gb/exchange/hybrid-deployment/set-up-modern-hybrid-public-folders
But we've run into issues with the script straight away when first run, the script gets through the initial check and validation of the Mail enabled Public Mail folders, but then gives us the following error which makes not much sense to me in regards to the Exchange version:
PS C:\Temp\PublicFolders> .\Sync-ModernMailPublicFolders.ps1 -csvSum
maryFile:sync_summary.csv -WhatIf
[23/09/2022 10:23:35 AM] Downloading ValidateMailEnabledPublicFolders script...
Checking for mail-enabled System folders...
Found 0 mail-enabled System folders.
Getting all public folders. This might take a while...
Found 907 public folders.
13 of those are mail-enabled.
0 folders are mail-enabled with no AD object.
13 folders are mail-enabled and are properly linked to an existing AD object.
Getting all MailPublicFolder objects...
0 MailPublicFolders are orphaned.
Building EntryId HashSets...
0 orphaned MailPublicFolder objects.
0 of those orphans point to mail-enabled folders that point to some other object
.
0 of those orphans point to mail-disabled folders.
No folders need to be mail-disabled.
No orphaned MailPublicFolders were found.
No duplicate MailPublicFolders were found.
No mail-disabled public folders with proxy GUIDs were found.
No disconnected MailPublicFolders were found.
Done!
Write-Error: You cannot execute this script from your local Exchange server: "Ve
rsion 15.0 (Build 1497.2)". This script can only be executed from Exchange 2007
Management Shell and above.
The script then ends there - Looks to me that the script versions or when it gets to that line is incorrect or has incorrect line there.
So I myself attempt to- amend the version part by commenting out the script line the references the version - which seems to just overlook the version and continue.
Following from there, there was then an error with what seems to be an InvalidOpration Method invocation failed because [system.string] does not contact method named 'ToStringArray', here is the out put this is after me amending the Version/commenting out above that it gets to this point on the script run, also after connecting to EXO through the script as it attempt to sync the objects:
PS C:\Temp\PublicFolders> .\Sync-ModernMailPublicFolders.ps1 -CsvSummaryFile:syn
c_summary_test.csv -WhatIf
Checking for mail-enabled System folders...
Found 0 mail-enabled System folders.
Getting all public folders. This might take a while...
Found 907 public folders.
13 of those are mail-enabled.
0 folders are mail-enabled with no AD object.
13 folders are mail-enabled and are properly linked to an existing AD object.
Getting all MailPublicFolder objects...
0 MailPublicFolders are orphaned.
Building EntryId HashSets...
0 orphaned MailPublicFolder objects.
0 of those orphans point to mail-enabled folders that point to some other object
.
0 of those orphans point to mail-disabled folders.
No folders need to be mail-disabled.
No orphaned MailPublicFolders were found.
No duplicate MailPublicFolders were found.
No mail-disabled public folders with proxy GUIDs were found.
No disconnected MailPublicFolders were found.
Done!
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove File" on target
"C:\Temp\PublicFolders\sync_summary_test.csv".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help
(default is "Y"):Y
if (Version 15.0 (Build 1497.2).Major -ne 8 -and Version 15.0 (Build 1497.2).Maj
or -ne 14)
{
Write-Error (System.Collections.Hashtable.LocalServerVersionNotSupported -f
Version 15.0 (Build 1497.2)) -ErrorAction:Continue;
Exit;
}
[23/09/2022 11:00:02 AM] Creating an Exchange Online remote session...
----------------------------------------------------------------------------
The module allows access to all existing remote PowerShell (V1) cmdlets in addit
ion to the 9 new, faster, and more reliable cmdlets.
|--------------------------------------------------------------------------|
| Old Cmdlets | New/Reliable/Faster Cmdlets |
|--------------------------------------------------------------------------|
| Get-CASMailbox | Get-EXOCASMailbox |
| Get-Mailbox | Get-EXOMailbox |
| Get-MailboxFolderPermission | Get-EXOMailboxFolderPermission |
| Get-MailboxFolderStatistics | Get-EXOMailboxFolderStatistics |
| Get-MailboxPermission | Get-EXOMailboxPermission |
| Get-MailboxStatistics | Get-EXOMailboxStatistics |
| Get-MobileDeviceStatistics | Get-EXOMobileDeviceStatistics |
| Get-Recipient | Get-EXORecipient |
| Get-RecipientPermission | Get-EXORecipientPermission |
|--------------------------------------------------------------------------|
To get additional information, run: Get-Help Connect-ExchangeOnline or check htt
ps://aka.ms/exops-docs
Send your product improvement suggestions and feedback to exocmdletpreview@servi
ce.microsoft.com. For issues related to the module, contact Microsoft support. D
on't use the feedback alias for problems or support issues.
----------------------------------------------------------------------------
Using ConnectionUri:'https://outlook.office365.com/powerShell-liveID', in the en
vironment:'O365Default'.
[23/09/2022 11:00:54 AM] Exchange Online remote session created successfully.
[23/09/2022 11:00:54 AM] Enumerating local mail enabled public folders...
[23/09/2022 11:00:55 AM] Mail public folders enumeration completed: 13 local fol
der(s) found.
[23/09/2022 11:00:55 AM] Enumerating Exchange Online mail enabled public folders
...
[23/09/2022 11:00:56 AM] Mail public folders enumeration completed: 0 Exchange O
nline folder(s) found.
Sync local changes to Exchange Online
The following local mail public folder changes were detected and will be
applied to Exchange Online: 13 object(s) created, 0 updated and 0 deleted. Do
you really want to proceed?
[N] No [Y] Yes [?] Help (default is "N"): Y
Removed the PSSession ExchangeOnlineInternalSession_1 connected to outlook.offic
e365.com
Disconnected successfully !
InvalidOperation: C:\Temp\PublicFolders\Sync-ModernMailPublicFolders.ps1:209
Line |
209 | $emailAddressesArray = $localFolder.EmailAddresses.ToStringArray( .
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Method invocation failed because [System.String] does not contain a
| method named 'ToStringArray'.
Then it terminates the operation from there.
Unfortunately I am now stuck here, I tried to raise a support request within Office 365 but they advised me they do not know much of this script and that I should seek support from Microsoft on-prem Products instead for this issue. I feel like the script is poorly written for this and that perhaps it has been an after thought.
I am hoping someone out here has some more knowledge that myself to try work out what is going on with this script and why won't it proceed, it would be truly appreciated.
The script (which is mentioned in the Microsoft Documentation) can be found here: https://www.microsoft.com/en-us/download/details.aspx?id=54855
(its the Sync-ModernMailPublicFolders.ps1 and SyncModernMailPublicFolders.strings.psd1)
This is our On-prem 2013 Exchange Versions:
Name : EXCH01
Edition : Enterprise
AdminDisplayVersion : Version 15.0 (Build 1497.2)
Name : EXCH03
Edition : Enterprise
AdminDisplayVersion : Version 15.0 (Build 1497.2)
Name : EXCH02
Edition : Enterprise
AdminDisplayVersion : Version 15.0 (Build 1497.2)
Name : EXCH04
Edition : Enterprise
AdminDisplayVersion : Version 15.0 (Build 1497.2)
Regards,
David.