How to Fix PowerShell History Not Working?

Once you have learned the beginner’s level of scripting language, then the Windows PowerShell will be exceedingly easy to you. Even after the knowledge of the language, users may encounter some restrictions and bumps in the process. One of the restrictions that users had reported is the shortcut of Ctrl+R is not working, which is the command to show the history or list of search.
How to Fix PowerShell History Not Working?
In this condition, users are not able to access the history section, which can be very helpful to users in many cases. Powershell had created an extensive built-in list of commands used previously, which helps you to access the list of complex commands and saves you extra time to run the same and hectic command more than one time.
When you can’t access the history section, then you can follow these steps to remedy the condition:
Test the assembly of PSReadLine
It is not a significant problem for the users of PowerShell and it generated when users upgraded to Windows 10. There is the possibility that you may remember the downloading the PSReadLine, even if you don’t, it comes to the Windows 10 package.
It removes the traditional view of the feature of history and creates the new and more sophisticated display of the list of commands. This function is not a built-in feature of the Windows Management Framework, so you have to depend on the third-party modules of PSReadLine.
If you want to make sure that the installation has removed the problem, then you should run the command “Get-PSReadLineOption.” If you get the error referring to the PSReadLine, later, you should try to change the layout of the keyboard to en-US and check again for any improvement.
Try Different Methods to Access the History
Suppose you want to access history for some previous command, but you are unable to access history from the Ctrl+R command.
Then it would be best if you tried different outlets to access history, and you can use the following cmdlet to do that:
  • Get-History
  • Get-History | Select-String -Pattern “Search.”
  • Get-History | Format-List -Property *
  • Get-History | Export-Clixml -Path c:pscommands_hist.xml
Increase Number Limit of Remember Command
As a default, the buffer of the Command line only stores 50 commands. You can increase the limit to save more command to store in your program memory.
If you want to increase this limit, then you have to follow this process:
  • Click the right button on the title bar of the window of PowerShell.
  • Tap on the Properties in the list of options.
  • Go to the Command History.
  • Now you have to change the Value of Buffer size as per your requirements.  
Try to PSReadLine and Downgrade it to 1.2
The new version of the PSReadLine is generating some glitches too. The reason for this one may be the reason for the glitch on the history.
So, you should try the previous version of the PSReadLine. It should be your last option because, in any up-gradation, the developer’s team resolves many problems and limitations of the present version.
Apart from these, the reason for the stopped history section can be the reason that it is turned off form the setting. It can happen because you have entered these command:
  • %userprofile%AppDataRoamingMicrosoftWindowsPowerShellPSReadlineConsoleHost_history.txt
  • Set-PSReadlineOption –HistorySaveStyle SaveNothing
If that is the case, you have to follow the same techniques to start the history command. Just make sure you didn’t use the Clear-History. If you have used this command somewhere in time, then the complete history will be erased.
Harry Martin is a creative person who has been writing blogs and articles about cyber security. He writes about the latest updates regarding office.com/setup and how it can improve the work experience of users. His articles have been published in many popular e-magazines, blogs, and websites.

Comments

Popular posts from this blog

Every New Character Released in Final Fantasy 7 Remake

How to Troubleshoot Camera Black Screen on iPhone?

How to Get the Windows 10, November 2019 Update