It is easy to view the command history of powershell, but sometimes, one might forget to record some important output of the commands, and wish to have a look back into what was on the screen?
Is the history of outputs automatically saved somewhere?
It is easy to view the command history of powershell, but sometimes, one might forget to record some important output of the commands, and wish to have a look back into what was on the screen?
Is the history of outputs automatically saved somewhere?
By default, PowerShell records history of commands, but not their output.
You can request PowerShell to record screen output into a file. Use Start-Transcript and Stop-Transcript for this.
Example
Start-Transcript
'do stuff here'
Get-Service X*
'do some more stuff here'
Stop-Transcript
If you want PowerShell to automatically record all your stuff every time, you can add Start-Transcript in your PowerShell profile (use $PROFILE system variable to find path to your profile script, then add Start-Transcript into it)
By default, a new text file is created every time you start transcript. If you want to keep adding output into the same file, then Start-Transcript -Path C:\ExistingTranscript.txt -Append