Skip to content

Commit

Permalink
Enhancement: Add clearer error message and FAQ on Powershell Core 7.1…
Browse files Browse the repository at this point in the history
… and above being unsupported

Closes #162
  • Loading branch information
leojonathanoh committed Jul 10, 2023
1 parent 07c9175 commit a8f2545
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ConvertOneNote2MarkDown-v2.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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), because Microsoft has removed support for importing Win32 GAC Assemblies since Powershell 7.1.
* 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)

Expand Down Expand Up @@ -168,11 +169,9 @@ 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`
### Q: WHy is Powershell Core 7.1 and above unsupported?

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).
A: Powershell `7.1.x` and above no longer supports loading Win32 GAC Assemblies for interacting with the OneNote Desktop APIs. Instead, 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`

Expand Down

0 comments on commit a8f2545

Please sign in to comment.