Q. How can I log everything typed and returned in a PowerShell session?
A. PowerShell version 4 and above has a transcript capability that logs information about the session, commands typed and the results. This can be started with:
$trans = start-transcript
and stopped with stop-transcript.
This can be enabled for all scripts via Group Policy:
- Open the policy you wish to use to apply
- Navigate to Computer Configuration - Administrative Templates - Windows Components - Windows PowerShell
- Double click Turn on PowerShell Transcription
- Set to Enabled and by default scripts will be saved to users Documents folders or a central folder can be specified where all transcripts will be saved to (make sure you secure this folder so users cannot see other users transcripts)