Powershell: Transcript (Log)

A transcript logs all action of a Powershell session to a text file; good for documenting and archiving.

With Start-Transcript, you begin a record of the current Powershell session.

After quitting the Powershell session, the recording stops, but you can also stop the recording manually by running Stop-Transcript.

You can also modify your Powershell profile to start recording automatically every time when you start a Powershell session by adding something similar like this to it:

$LogFolder = "$Home\Documents\WindowsPowerShell\Logs"
Get-Item -Path "$LogFolder\Log-*.txt" | Where {$_.LastWriteTime -lt ((Get-Date).AddDays(-90))} | Remove-Item
Start-Transcript -NoClobber -Append -Path $LogFolder\Log-$(Get-Date -Format yyyy-MM-dd).txt
# ...
# Stop-Transcript

A few words abou the parameters: