Commands / System

Start-Transcript

Record the session to a log file

beginner System

Start-Transcript
 Start-Transcript -Path (Join-Path $env:TEMP 'ps-transcript.txt')
Works on
WindowsLinuxmacOS
PowerShell
5.1 and later
Reference
Microsoft Learn: Start-Transcript

Logs input and output. Stop with Stop-Transcript. Put the file in $env:TEMP or a folder you chose. Do not log secrets. The companion script in this repo wraps a safer path.

Try this

Start-Transcript -Path (Join-Path $env:TEMP 'ps-transcript.txt')
Get-Date
Stop-Transcript

Coming from another shell

ShellWhat you might type
bash / zshscript session.log

More in From bash and From cmd.