Skip to content
Melbit Services
  • IT Services
    • Managed IT Services
    • Cloud Services
    • IT Consulting Services
    • Business Communication
    • Remote IT Support
    • Domain Names
  • Industries
    • Accounting Firms
    • Law Firms
    • Realestate
    • Medical Centres
    • Pharmacies
    • Conveyancing Firms
  • Cybersecurity
    • Cybersecurity Assessment
    • The Essential Eight
    • Cybersecurity Playbooks
    • Computer Security Threats
  • Remote IT Support
    • TeamViewer Windows
    • TeamViewer Mac
    • TeamViewer Linux
Get in Touch

Windows

23
  • Understanding MFA
  • How to change file creation or modified date
  • How to check if Microsoft Defender for Endpoint is running
  • 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)
  • Command and PowerShell History
  • How to increase the disk size of VM in VirtualBox
  • Saved Windows Credentials
  • View installed software using wmic
  • Pros and cons working with DNS, DHCP, IPAM, Wireless, LAN, WAN
  • What is a DHCP Server and DHCP relays
  • How to find user profile disk from registry
  • Enabling iPhone hotspot
  • Download Maps Manager Delayed Start Red in Server 2016
  • What is SSTP VPN?
  • 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
  • Essential Network Ports for Windows Services
  • Another account from your organisation is already signed in
  • Disabling Office 365 Autodiscover – Exchange Self hosted
Linux

Linux

5
  • mysql-8.0-gpg package error
  • Windows Privilege Escalation
  • Linux Exim Cheat sheet
  • Rsync linux
  • CSF Shell Command

Networking

5
  • Windows Privilege Escalation
  • 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

15
  • How to improve the WIFI coverage in the office
  • Best Practices for Data Backup and Recovery
  • How to change file creation or modified date
  • Command and PowerShell History
  • How to increase the disk size of VM in VirtualBox
  • Saved Windows Credentials
  • View installed software using wmic
  • Cannot access FortiGate web GUI admin interface
  • How to find Fortinet PSK
  • Pros and cons working with DNS, DHCP, IPAM, Wireless, LAN, WAN
  • What is a DHCP Server and DHCP relays
  • How to find user profile disk from registry
  • Enabling iPhone hotspot
  • Disabling SIP ALG on FortiGate Firewall
  • Download Maps Manager Delayed Start Red in Server 2016

Network Connectivity

4
  • How to improve the WIFI coverage in the office
  • Enabling iPhone hotspot
  • Disabling SIP ALG on FortiGate Firewall
  • What is SSTP VPN?

Cyber Security & Compliance

4
  • How to check if Microsoft Defender for Endpoint is running
  • Access to Removable Drives not Protected by BitLocker
  • The Group Policy settings for BitLocker startup options are in conflict and cannot be applied
  • Windows Privilege Escalation

Remote IT Support & Helpdesk

6
  • mysql-8.0-gpg package error
  • 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)
  • Atera client not showing up in Customer’s dashboard
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
How to change file creation or modified dateHow 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
  • FAQ
  • Contact

© 2025 Melbit Services, All Rights Reserved.

  • Terms and Conditions
  • Privacy Policy