$MaximumHistoryCount = 100



  • Run Get-History | Export-CliXMLfilename to export commands to an XML file. Send the XML file to a colleague, and they can quickly repeat those commands by running Import-CliXMLfilename | Invoke-History.
  • Use the StartExecutionTime and EndExecutionTime properties to measure the time it took to complete a command. For example: get-history | select commandline,executionstatus,startexecutiontime,endexecutiontime,@{n=’ExecutionDuration’;e={$_.EndExecutionTime – $_.StartExecutionTime}}
  • Quickly locate past commands without having to scroll through with the Up Arrow key. For example, if you know you ran a command that used “Select,” try this to find it: get-history | where { $_.CommandLine -like ‘*select*’ }