Windows PowerShell - How to view commands history date/time

Super User Asked by Ramin on December 6, 2020

I want to list entered commands in Windows PowerShell with their respective timestamps. How can I do it with Get-History command?

Also if that isn’t doable then please show me a way to check which urls(network) at which timestamps have been accessed through the CMD.

Also consider that I’ve restarted my computer.

5 Answers

For PowerShell 5.1 and PowerShell Core, I've added this to my $PROFILE to make it a little easier to remember:

function Get-PSReadLineHistory
    Get-Content (Get-PSReadlineOption).HistorySavePath

Answered by Glenn on December 6, 2020

Get-History | Select StartExecutionTime,ID,CommandLine

Answered by James Sargent on December 6, 2020

The Powershell history is saved in the file ConsoleHost_history.txt to find the location of the file execute this PS command: (Get-PSReadlineOption).HistorySavePath

Answered by AcmeUK on December 6, 2020

On Windows 10, the PS extension PsReadline comes with PowerShell 5 by default. Get-Content on the following to view your full command history.


To make it available on Windows 7, you have to make sure you have the latest Framework and PowerShell 5 installed. Then you can install the PsReadline module.

I just did on a Windows 7 (64) machine:

(executionpolicy : remotesigned)

Install-Module PSReadLine ( I was asked to install NuGet-anycpu.exe, and answered yes).

Import-Module PsReadLine

Your history will now be stored in the file mentionned above (verified)

Run Get-PSReadlineKeyHandler to have a list of PSReadline Key bindings.

Answered by Dan St-G on December 6, 2020

As far as I'm aware, once you close a PowerShell console all history and logs are disposed.

You could check out something like: Giving PowerShell a Persistent History of Commands

Of course this won't retrieve anything you've already done, it will only start logging from the point you install it.

EDIT: PowerShell 5.0 appears to have implemented a persistent history, available even after restart, accessible via the usual ways.

Answered by Deadly-Bagel on December 6, 2020

Add your own answers!

Related Questions

Problems with the WD passport

1  Asked on January 18, 2021 by w0051977


Concatenating an image with a video with ffmpeg

1  Asked on January 18, 2021 by lance


bootable USB not booting

1  Asked on January 17, 2021 by max-neumann


Virtualbox NAT and host-only connection

3  Asked on January 17, 2021 by beach-chicken


Generate Time ranges in Excel 365

1  Asked on January 17, 2021 by spydercoll


Opening port: basic questions

2  Asked on January 16, 2021 by starbuck


config Nginx to start server in two LANs

0  Asked on January 16, 2021 by zhaogang


How can I count unique values in Excel?

1  Asked on January 14, 2021 by berg_durden


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP