clear-history
Delete entries from the PowerShell session command history. tldr-pages
On Windows
Windows
Delete entries from the PowerShell session command history. Note: clhy can be used as an alias for Clear-History.
Clear all command history from current session
Clear-HistoryIdentifyClear command by specific name
Clear-History -CommandLine "command"IdentifyClear multiple commands by name
Clear-History -CommandLine "command1", "command2", ...IdentifyClear a specific history entry by ID
Clear-History -Id id_numberIdentifyClear multiple IDs
Clear-History -Id id1, id2, ...IdentifyClear commands within a range of IDs
Clear-History -Id (start_id..end_id)IdentifySimulate clearing the history, showing what would be deleted
Clear-History -WhatIfIdentifyAsk for confirmation before clearing
Clear-History -ConfirmIdentify