If you use Powershell regularly, you may want to record Powershell command session Windows 10. Do you know how to do this work easily? Now, in this post, we will tell you how to record a command session in PowerShell.

Perhaps, you always work with PowerShell commands and scripts on your Windows 10 computer. In this situation, you may want to record these commands and the output you can see on the interface by using a text file format for troubleshooting or documentation purposes.

Then, do you know how to record Powershell command session Windows 10?

Usually, you can copy your needed information manually. If you are an advanced user, you may prefer to use different commands to export outputs individually.

Here, Powershell is just such a utility which contains a simpler command that enables you to create a transcript of an entire console session. At the same time, there are different options in the transcript command which can be used to control the various aspects of the target output file.

In the following guide, we will show you a guide to create a transcript of a PowerShell command session into a text file.

How To Fix DiskPart Has Encountered An Error - Solved
How To Fix DiskPart Has Encountered An Error - Solved

The DiskPart has encountered an error may appear because of many reasons and I’ll analyze the causes and give solutions to you.

Read More

How to Record a Command Session in PowerShell

If you want to create a transcript of every command that you type in PowerShell in a particular console session, please follow these steps:

Step 1: Open Start and search for PowerShell. Then, choose the first search result to open it.

Step 2: After entering the interface, you need to type the following command to begin recording the session to a text file. Next, click Enter.

Start-Transcript -Path “C:\FOLDER\PATH\POWERSHELL_TRANSCRIPT_FILENAME.txt” -NoClobber

Here in the command, you need to update the text output file with the location and filename that you want to use. And the -NoClobber switch is used to prevent the existing record from being overwriting.

After ending these steps, you will be able to run commands as usual. And in the computer background, PowerShell will create a transcript in a text file format, and the file will be saved in the path that you have specified in the command.

When finishing using the Powershell, you can shut up the console or use the Stop-Transcript command to stop the recording process immediately.

After that, you can open the text file with any type of text editor to view all the commands you have typed and the output as they appeared in the console.

On the other hand, you may note that the record command can also save other related information including the start time of the transcript, whether the console was using elevated privileges, computer name, version of Windows 10, and more.

Some Other Parameters

The Start-Transcript command also contains some other switches to control the behavior.

Here, we will show you some examples as follows:

If you use the -Append switch instead of the -NoClobber in the command, the new session will be saved at the end of the existing output file.

Start-Transcript -Path “C:\sessions\ps_recording01.txt” -Append

Additionally, to log the exact time when each command in the session was executed, you can use the -IncludeInvocationHeader switch at the end of the command.

The command line is as follows:

Start-Transcript -Path “C:\sessions\ps_recording01.txt” -NoClobber -IncludeInvocationHeader

If you don’t want to code with filenames, you can apply the -OutputDirectory switch rather than the -Path switch to enable PowerShell to name the output files automatically in the command.

Start-Transcript -OutputDirectory “C:\sessions”

Of course, there are some other commands. You can search for them on the internet by yourself.

If you delete the text file by mistake, you can use a free file recovery tool to get them back. MiniTool Power Data Recovery is a good choice.

  • linkedin
  • reddit