![Forrest logo](/images/logo.png)
get-history:tldr:b2601
The "Get-History" command is used in PowerShell to retrieve a list of commands that were previously executed in the current session. It displays the history of commands and their execution order.
When you run the "Get-History" command, it returns an object that contains information about each command, such as its ID, the time it was executed, and the command-line text itself. The history is stored in memory for the duration of the session, and it can be accessed using this command.
The output of the "Get-History" command typically includes columns like "Id", "CommandLine", "ExecutionStatus", "StartExecutionTime", "EndExecutionTime", and more. This information can be useful for reviewing the command history, repeating or modifying previously used commands, or troubleshooting.
It's worth noting that the command history in PowerShell is limited to the current session, so if you close and reopen PowerShell, the history will be reset. Additionally, the number of commands stored in the history can be limited based on the system's configuration.