Monthly Archives: January 2016

Quicktip: PowerShell command history on Windows 10 using PSReadline

In Windows 10 PowerShell 5.0 comes bundled with PSReadline. This module allows for a number of useful features and today we will focus on getting access to the command history. A very useful feature of PSReadline is that it writes the history of PowerShell commands to a text file and this text file is easily accessible. The path where this file is stored can be found by executing the following command:

1
(Get-PSReadlineOption).HistorySavePath

PSReadLine

To view the list of previously executed commands you can type the following:

1
Get-Content -Path (Get-PSReadlineOption).HistorySavePath

This will output the contents of the history file to your PowerShell console. Alternatively the file can be opened by your favorite editor by using the Invoke-Item cmdlet:

1
Invoke-Item -Path (Get-PSReadlineOption).HistorySavePath

A very useful feature if you accidentally closed your console without saving your command history.

PowerShell 4.0 Update available for 2012/2008R2/Windows 7

New PowerShell 4.0 updates have been released, part of the Windows Management Framework 4.0 (WMF 4.0). With WMF 5.0 released and then later temporarily retracted from the download center there might be some confusion about who this patch is for, I hope to clear up some of that in this blog post.

So first and foremost, this is a PowerShell 4.0 Update package now also released for Windows Server 2012/2008 R2 SP1 and Windows 7SP1. This upgrade package contains some improvements in regards to DSC and PowerShell logging, please refer to the following two blog articles by the PowerShell team for full details:
Windows Management Framework (WMF) 4.0 Update now available…
Windows Management Framework (WMF) 4.0 Update is coming your way

So more importantly who is this patch intended for, from my perspective this patch is for the following situations:

  • You have WMF 4.0 installed and are in need of the features and fixes offered by this patch
  • Upgrading to PowerShell 5.0 (once it is re-released) is not an option because of incompatibilities which prevent you from upgrading
  • You are in an enterprise environment where roll-outs of completely new versions is limited but patching is possible
  • You are a curious individual and would like to play with the latest, supported, version of PowerShell on your version of Windows

WMF40Update

For more information about what is new in this update, please refer to the following article:
What’s New in Windows PowerShell

The WMF 4.0 updates are currently available as a separate downloads for the following Windows versions:

Operating System Service Pack Prerequisites UPDATE
Windows Server 2012 WMF 4.0 is installed and .NET Framework 4.5 KB3119938
Windows Server 2008 R2 SP1 WMF 4.0 is installed and .NET Framework 4.5 KB3109118
Windows 7 SP1 WMF 4.0 is installed and .NET Framework 4.5 KB3109118

For more information these WMF 4.0 Updates and the links in this article please refer to the links below:

Links in this Article
Windows Management Framework (WMF) 4.0 Update now available…
Windows Management Framework (WMF) 4.0 Update is coming your way
What’s New in Windows PowerShell