Forum Discussion
Script execution problem for migration of exchange 2016 public folders to office365
Hello,
We have started a migration from exchange 2016 to office365.
for user mailboxes, everything went well
For the migration of public folders, I ran the script "Export-ModernPublicFolderStatistics.ps1"
Problem:
[25/11/2022 08:14:30] Enumerating folders under IPM_SUBTREE...
[25/11/2022 08:15:33] Enumerating folders under IPM_SUBTREE completed...7952 folders found.
[25/11/2022 08:15:33] Enumerating folders under NON_IPM_SUBTREE...
[11/25/2022 08:16:35] Enumerating folders under NON_IPM_SUBTREE completed...8035 folders found.
[25/11/2022 08:16:35] Retrieving statistics...
C:\ScriptsMigration2\Export-ModernPublicFolderStatistics.ps1 : Failed when calling the method, because [System.String] does not contain a method named "ToBytes".
At character Line:1: 1
+ .\Export-ModernPublicFolderStatistics.ps1 stats.csv
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation : (:) [Export-ModernPublicFolderStatistics.ps1], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound,Export-ModernPublicFolderStatistics.ps1
I can't generate my mapping file ...
Can someone help me?
Thanks
Raphael_Veauvy I was hoping to go through this article yesterday and move our Exchange 2013 on-premises Public Folders to Exchange Online. Unfortunately I came across the same issue which is item 1 under Step 3: Generate the .csv files. I did successfully run the script back in June this year but never did finish this migration.
The article mentions:
To run the migration scripts in this article, you must use an account that has basic authentication enabled. Accounts that use multi-factor authentication (MFA) are currently not supported.
Here is a link but it pertains to Exchange Online and we're running the script against our on-premises server but I'm wondering if it will impact any of the other scripts?
Thanks
* Update - I ran Powershell as an admin on my Exchange 2013 server, ran this command Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn and was able to run the script without error. I was using Exchange Powershell and it wasn't working.
- Office365BuddyBrass Contributor
Raphael_Veauvy
Export-ModernPublicFolderStatistics.ps1 script fails and returns a ToBytes error - Exchange | Microsoft Learn
its because of November SU update patch - PrayingMosesCopper ContributorHi,
I faced this issue too and found this possible reason, see:
https://techcommunity.microsoft.com/t5/exchange-team-blog/released-november-2022-exchange-server-security-updates/bc-p/3674199/highlight/true#M34827
Regards- Raphael_VeauvyCopper ContributorHello,
I tested the script on 2 versions of exchange:
(get-item $env:ExchangeInstallPath\bin\setup.exe).versioninfo.fileversion
- 15.01.2375.031
- 15.01.2375.037
on version 15.01.2375.037, I get the error.
- Cabarrus300Copper Contributor
Raphael_Veauvy I was hoping to go through this article yesterday and move our Exchange 2013 on-premises Public Folders to Exchange Online. Unfortunately I came across the same issue which is item 1 under Step 3: Generate the .csv files. I did successfully run the script back in June this year but never did finish this migration.
The article mentions:
To run the migration scripts in this article, you must use an account that has basic authentication enabled. Accounts that use multi-factor authentication (MFA) are currently not supported.
Here is a link but it pertains to Exchange Online and we're running the script against our on-premises server but I'm wondering if it will impact any of the other scripts?
Thanks
* Update - I ran Powershell as an admin on my Exchange 2013 server, ran this command Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn and was able to run the script without error. I was using Exchange Powershell and it wasn't working.
- Raphael_VeauvyCopper Contributor
Hi, you are great.
I opened a new windows powershell console as administrator, run the line "Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn"
then, I executed the script without error (I got the CSV file correctly)
the script ran correctly...I tried to run the script again in a new powershell exchange window : same error
I compared the 2 versions of powershell (Windows and Exchange) on the same server (Exchange 2016):
WINDOWS:
Name Value
---- -----
PSVersion 5.1.14393.5127
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.5127
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1EXCHANGE:
Name Value
---- -----
PSVersion 5.1.14393.5127
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0, 5.0, 5.1.14393.5127}
BuildVersion 10.0.14393.5127
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1It's OK for me, I can continue my migration
Thank you very much for this tip.
- DCJENKINSCopper Contributor
Thank You! This solution worked for me as well....
"* Update - I ran Powershell as an admin on my Exchange 2013 server, ran this command Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn and was able to run the script without error. I was using Exchange Powershell and it wasn't working. "
- DCJENKINSCopper Contributor
Having the exact same issue here but I'm trying to move from Exchange 2013
Raphael_Veauvy