You have often worked with PowerShell commands and scripts and you might want to transcript those commands as well as their outputs as a record or for future reference. While you may also do it by manually copy and paste them in a text file or you can type individual commands to save the input of commands entered in PowerShell.
However, PowerShell simplifies this solution. It let you transcript commands and their outputs of a PowerShell session in a text file.
In this article, I will describe the method using which you can transcript or record the PowerShell session.
In the search bar of windows, type PowerShell and from the results that appear, click on PowerShell.
In the PowerShell command window, type:
Start-Transcript -Path "Desktop\transcript.txt"
All the commands you have run with their outputs will be saved in the desktop as a text file. You can later view this in notepad.
Append to an existing file
Adding -append at the end of transcript command allows adding new transcript at the end of an existing file without overwriting.
Add the following command in PowerShell:
Start-Transcript -Path "Desktop\transcript.txt" -append
After entering the above command, now enter the other your everyday commands and scripts.
The above command will append the recent commands and their outputs in the existing text file without overwriting it.
Confirm before execution
You can add -confirm parameter after the transcript command. It will ask for confirmation before executing the command.
Start-Transcript -Path "Desktop\transcript.txt" -confirm
By following the above method, you can easily transcript the complete session of PowerShell commands and their outputs as a text file in the specified location.
The post How to transcript command session in PowerShell appeared first on FAQforge.