Skip to content
Business IT Services, Support Melbourne
  • IT Services
    • Managed IT Services
    • Cloud Services
    • Microsoft 365 Managed Service
    • IT Consulting Services
    • Remote IT Support
    • Business Communication
      • Get started with 3CX
  • Industries
    • Accounting Firms
    • Law Firms
    • Realestate
    • Medical Centres
    • Pharmacies
    • Conveyancing Firms
  • Cybersecurity
    • SaaS Security
    • Assessment
    • The Essential Eight
      • Quick Assessment
    • Playbooks
    • Computer Security Threats
  • Remote IT Support
    • TeamViewer Windows
    • TeamViewer Mac
    • TeamViewer Linux
Get in Touch

Windows

23
  • Command and PowerShell History
  • How to increase the disk size of VM in VirtualBox
  • Saved Windows Credentials
  • View installed software using wmic
  • How to Disable Revocation Check for SSTP VPN
  • Enabling Group Policy editor on Windows 10 Home
  • Source file names are larger than supported file system
  • How to change file creation or modified date
  • Another account from your organisation is already signed in
  • How to check if Microsoft Defender for Endpoint is running
  • Disabling Office 365 Autodiscover – Exchange Self hosted
  • Access to Removable Drives not Protected by BitLocker
  • The Group Policy settings for BitLocker startup options are in conflict and cannot be applied
  • How do you extend a User Profile Disk
  • Resizing User Virtual Disk RDP (Esxi VM)
  • Essential Network Ports for Windows Services
  • Why does OneDrive keep duplicating files
  • Troubleshooting USB devices
  • Download Maps Manager Delayed Start Red in Server 2016
  • Pros and cons working with DNS, DHCP, IPAM, Wireless, LAN, WAN
  • What is a DHCP Servers and DHCP relays
  • How to find user profile disk from registry
  • Understanding Multi-Factor Authentication
Linux

Linux

8
  • Rsync linux
  • CSF Shell Command
  • mysql-8.0-gpg package error
  • Linux Exim Cheat sheet
  • csf configserv commands
  • Nmap cheat sheet
  • nmap
  • Windows Privilege Escalation

Networking

4
  • Cannot access FortiGate web GUI admin interface
  • How to find Fortinet PSK
  • Pros and cons working with DNS, DHCP, IPAM, Wireless, LAN, WAN
  • Disabling SIP ALG on FortiGate Firewall

General IT Support

12
  • TPM has malfunction error 80090016 keyset does not exist
  • Command and PowerShell History
  • How to increase the disk size of VM in VirtualBox
  • Saved Windows Credentials
  • View installed software using wmic
  • How to improve the WIFI coverage in the office
  • Best Practices for Data Backup and Recovery
  • How to change file creation or modified date
  • How to sync a SharePoint site with OneDrive
  • Cannot access FortiGate web GUI admin interface
  • Pros and cons working with DNS, DHCP, IPAM, Wireless, LAN, WAN
  • What is a DHCP Servers and DHCP relays

Network Connectivity

4
  • How to improve the WIFI coverage in the office
  • Common Internet connectivity problems and solutions
  • What is SSTP VPN?
  • Enabling iPhone hotspot

Cyber Security & Compliance

3
  • How to check if Microsoft Defender for Endpoint is running
  • The Group Policy settings for BitLocker startup options are in conflict and cannot be applied
  • Windows Privilege Escalation

Remote IT Support & Helpdesk

5
  • Atera client not showing up in Customer’s dashboard
  • The Group Policy settings for BitLocker startup options are in conflict and cannot be applied
  • How do you extend a User Profile Disk
  • Resizing User Virtual Disk RDP (Esxi VM)
  • mysql-8.0-gpg package error
View Categories
  • Home
  • kb
  • General IT Support
  • Command and PowerShell History

Command and PowerShell History

1 min read

Using Get-History cmdlet   #

  • Get-Command History: Use Get-History in PowerShell to view your session’s command history
  • Retrieve Command by ID: You can re-run a command by its history ID:Invoke-History -Id <ID>
  • Exporting Command History: Save the command history to a file for future reference.Get-History | Export-Csv -Path "C:\path\to\history.csv" -NoTypeInformation

Using h alias #

  • The Get-History cmdlet has a short alias, h, that you can use as a shorthand: h

Permanent Command History Across Sessions #

PowerShell does not persist command history by default across sessions. However, using the PSReadLine module (available in PowerShell 5.1+), you can enable persistent history.

  • Enable PSReadLine Module: Ensure it’s installed and loaded.Install-Module -Name PSReadLine
    Import-Module PSReadLine
  • View Persistent History:Get-Content (Get-PSReadlineOption).HistorySavePath

Viewing Command History from Previous Sessions  #

PowerShell saves command history across sessions in a file. You can open this file to view your past commands. The default location for this file is:

  • Windows PowerShell: C:\Users\<YourUserName>\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt
  • PowerShell (Core): C:\Users\<YourUserName>\AppData\Roaming\Microsoft\PowerShell\PSReadLine\ConsoleHost_history.txt

You can open this file in any text editor or view its contents using PowerShell:

Get-Content "$env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt"

Or for PowerShell Core:

Get-Content "$env:APPDATA\Microsoft\PowerShell\PSReadLine\ConsoleHost_history.txt"

This allows you to view a persistent history across multiple sessions.

Clear Command History #

  • Clear PowerShell History for Current Session:Clear-History
  • Delete Persistent PowerShell History: Locate the history file and delete or clear it:Remove-Item (Get-PSReadlineOption).HistorySavePath
Share This Article :
  • Facebook
  • X
  • LinkedIn
  • Pinterest
TPM has malfunction error 80090016 keyset does not existHow to increase the disk size of VM in VirtualBox
Table of Contents
  • Using Get-History cmdlet  
  • Using h alias
  • Permanent Command History Across Sessions
  • Viewing Command History from Previous Sessions 
  • Clear Command History
Melbourne business IT logo

Melbits is Melbourne Business IT Service and technology solutions provider. Our tailored and strategic approach ensures that your business will receive expert IT support, cybersecurity and consulting that aligns with your business needs, empowering your business, driving growth and success.

You can reach us at 03 9069 6788

IT Services

  • Managed IT Services
  • Cloud Services
  • Cybersecurity
  • Remote IT Services
  • Business Communication
  • IT Consulting

Industries

  • Accounting Firms
  • Law Firms
  • Realestate
  • Medical Centres
  • Pharmacies
  • Conveyancing Firms

Additional Links

  • About Us
  • Knowledge Base
  • Case Studies
  • Blog
  • Contact
  • FAQ

© 2025 Melbit Services, All Rights Reserved.

  • Terms and Conditions
  • Privacy Policy