CmdID

CmdID / PowerShell / Cmdlets / Get

Get-History

Gets a list of the commands entered during the current session. PowerShell reference

From the PowerShell reference 2 parameters Aliases ghy, history

Opens CmdID with your command, read as PowerShell. It is read in your browser and sent nowhere.

What it does

from the PowerShell reference, CC BY 4.0

Gets a list of the commands entered during the current session. The Get-History cmdlet gets the session history, that is, the list of commands entered during the current session. PowerShell automatically maintains a history of each session. The number of entries in the session history is determined by the value of the $MaximumHistoryCount preference variable. Beginning in Windows PowerShell 3.0, the default value is 4096. By default, history files are saved in the home directory, but you can save the file in any location. For more information about the history features in PowerShell, see about_History. The session history is managed separately from the history maintained by the PSReadLine module. Both histories are available in sessions where PSReadLine is loaded. This cmdlet only works with the session history. For more information see, about_PSReadLine.

Get-History [[-Id] <Int64[]>] [[-Count] <Int32>] [<CommonParameters>]

Get the session history

Get-HistoryIdentify

Get entries that include a string

Get-History | Where-Object {$_.CommandLine -like "Service"}Identify

Export history entries up to a specific ID

Get-History -Id 7 -Count 5 | Export-Csv -Path History.csvIdentify

Display the most recent command

Get-History -Count 1Identify

Display all the properties of the entries in the history

Get-History | Format-List -Property *Identify

Its page in the reference: Get-History.

Parameters

2 in the PowerShell reference
-CountSpecifies the number of the most recent history entries that this cmdlet gets. By, default, Get-History gets all entries in the session history. If you use both the Count and Id parameters in a command, the display ends with the command that is specified by the Id parameter. In Windows PowerShell 2.0, by default, Get-History gets the 32 most recent entries.
-IdSpecifies an array of the IDs of entries in the session history. Get-History gets only specified entries. If you use both the Id and Count parameters in a command, Get-History gets the most recent entries ending with the entry specified by the Id parameter.