From 8b9c13a9978a803990c2ab3877a46dd515d0fde7 Mon Sep 17 00:00:00 2001 From: Leonard Jonathan Oh Date: Mon, 10 Jul 2023 16:55:15 +0000 Subject: [PATCH] Enhancement: Add clearer error message and FAQ on Powershell Core 7.1 and above being unsupported Closes #162 --- ConvertOneNote2MarkDown-v2.ps1 | 2 +- README.md | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/ConvertOneNote2MarkDown-v2.ps1 b/ConvertOneNote2MarkDown-v2.ps1 index ac8b727..740cf53 100644 --- a/ConvertOneNote2MarkDown-v2.ps1 +++ b/ConvertOneNote2MarkDown-v2.ps1 @@ -15,7 +15,7 @@ Function Validate-Dependencies { # Validate Powershell versions. Supported version are between 5.x (possibly lower) and 7.0.x if ($PSVersionTable.PSVersion -ge [version]'7.1') { - throw "Unsupported Powershell version $( $PSVersionTable.PSVersion ). Supported versions are between Powershell 5.x and 7.0.x. See README.md for instructions to install Powershell 7.0.x" + throw "Unsupported Powershell version $( $PSVersionTable.PSVersion ), because it does not support importing Win32 GAC Assemblies. Supported versions are between Powershell 5.x and 7.0.x. See README.md for instructions to install Powershell 7.0.x" } # Validate assemblies diff --git a/README.md b/README.md index 84c1f25..b776484 100644 --- a/README.md +++ b/README.md @@ -50,10 +50,11 @@ The powershell script `ConvertOneNote2MarkDown-v2.ps1` will utilize the OneNote * Windows >= 10 -* Windows Powershell 5.x, or [Powershell Core 6.x up to 7.0.x](#q-how-to-install-and-run-powershell-70x) +* Windows Powershell 5.x, or [Powershell Core 6.x up to 7.0.x](#q-how-to-install-and-run-powershell-70x). Note: - * Note: There is no need to install Windows Powershell, since it is already included in Windows 10 / 11 (click Start > `Windows Powershell`). Installing Powershell Core is optional. - * Note: Do not use Windows Powershell ISE, because it [does not support long paths](#error-convert-onenotepage--error-while-renaming-image-file-name-references-to-xxxpng-illegal-characters-in-path). + * Windows Powershell is already included in Windows 10 / 11 (click Start > `Windows Powershell`). Installing Powershell Core is optional. + * [Powershell Core 7.1 and above is unsupported](#q-why-is-powershell-core-71-and-above-unsupported). + * Do not use Windows Powershell ISE, because it [does not support long paths](#error-convert-onenotepage--error-while-renaming-image-file-name-references-to-xxxpng-illegal-characters-in-path). * Microsoft OneNote >= 2016 (To be clear, this is the Desktop version, not the Windows Store version. Can be downloaded for free [here](https://www.onenote.com/Download) @@ -160,6 +161,10 @@ A: To install Powershell `7.0.13` (the highest supported version of Powershell) To uninstall after your are done converting, simply delete the `C:\PowerShell-7.0.13-win-x64` directory. +### Q: Why is Powershell Core 7.1 and above unsupported? + +A: Powershell `7.1.x` and above no longer supports loading Win32 GAC Assemblies, which is needed for interacting with the OneNote Desktop APIs. It is very unlikely that Microsoft will add support for later Powershell Core versions, since Win32 is starting to become deprecated. + ### Q: Error(s) when opening OneNote as Administrator A: If there are errors opening OneNote as Administrator, just open it normally without Administrator permissions. A user has reported successful conversion with only Powershell opened as Administrator. See [case](https://github.com/theohbrothers/ConvertOneNote2MarkDown/issues/149#issuecomment-1418051753). @@ -168,12 +173,6 @@ A: If there are errors opening OneNote as Administrator, just open it normally w A: The script cannot detect notebooks which are not yet open in OneNote. Use `File > Open` in OneNote to open all OneNote notebooks that you want to convert, and ensure they are all fully synchronized before running the conversion. This applies to local OneNote notebooks and cloud OneNote notebooks (E.g. OneDrive or Microsoft Teams). -### Error: `Unsupported Powershell version` - -Cause: Powershell `7.1.x` and above does not support loading Win32 GAC Assemblies. - -Solution: Use a version of Powershell between `5.x` and `7.0.x`. See [here](#q-how-to-install-and-run-powershell-70x). - ### Error: `Error HRESULT E_FAIL has been returned from a call to a COM component` Cause: Powershell `7.1.x` and above does not support loading Win32 GAC Assemblies.