Updating help for the PSReadLine module

Sean

Updating help for the PSReadLine module

You may have noticed an error message when trying to update the help for the PSReadLine module.

Error updating PSReadLine help

In the example above, I am trying to update help for the PSReadLine module on my Windows computer. Take a close look at the error message. Notice the spelling of the module name in the message:

Failed to update Help for the module(s) ‘PSReadline

In PowerShell 6 and higher, the PSReadLine module is spelled with a capital L character. But the error message is using a lowercase letter.

The root cause of the error

The problem comes from Windows PowerShell 5.1. The version of the PSReadline module that shipped in Windows PowerShell 5.1 used a lowercase letter in the name. The name of the module was changed for the release of PowerShell 6. It now uses a capital L in the name.

The Update-Help cmdlet constructs the URL of the CAB file containing the updated help. The URL path is case-sensitive. The updated help files use the new name with the capital L. PowerShell 6 and higher is installed side-by-side with Windows PowerShell. When you run Update-Help, the cmdlet attempts to update the help for both versions of PowerShell. The name of the module that Update-Help uses is based on the name of the folder where the help is stored. For Windows PowerShell this is C:\Program Files\WindowsPowerShell\Modules\PSReadline.

Note that only the update of help for the Windows PowerShell location is failing.

How to fix this problem

Fortunately the fix is simple. Just rename the folder to C:\Program Files\WindowsPowerShell\Modules\PSReadLine. To rename this folder, you must be sure to close all Windows PowerShell sessions to release any open file handles on the directory. Use the Windows File Explorer to rename the file. If you try to rename the folder from the command line, you receive the following error message.

Rename-Item: Source and destination path must be different.

Rename module folder

 

5 comments

Comments are closed. Login to edit/delete your existing comments

  • Fleet Command

    I assume a ramification of this fix is that after applying it, Windows PowerShell 5.1 won’t be able to update its PSReadLine. So, the Windows team won’t be pushing out this fix in their next cumulative update.

    • Sean WheelerMicrosoft employee

      No. Windows PowerShell 5.1 also experiences the same error when updating the help for PSReadLine. And you fix it the same way. Making this change does not prevent you from updating the PSReadLine module. There are no plans for the Windows team to push a fix in an update.

      • Fleet Command

        Windows PowerShell 5.1 also experiences the same error when updating the help for PSReadLine. And you fix it the same way.

        Actually, I am entirely unable to update the help for PSReadLine from within Windows PowerShell 5.1, with or without this fix. Either way, it can’t find the help file’s XML.

  • Terry Wrennall

    I like that you’ve gone `update-help psreadline -force` so you don’t see the errors for the other Microsoft modules that also give the same error message 😉

    • Sean WheelerMicrosoft employee

      This post is specifically about the PSReadLine module. The other Microsoft modules cause errors for different reasons. We are working with the content owners to fix those modules.