Record the commands used in PowerShell to a text file

 

 

When working in PowerShell testing and using commands after closing the PowerShell window all the information is lost and no commands can be found when returning to a new PowerShell window.

After closing the PowerShell window the up and down arrow won’t showing the used commands.

 

How do I record the commands in PowerShell to a text file?

 

Start the following command before debugging or working in PowerShell.

Start PowerShell as administrator. And type:

# Start-Transcript

 

This will create a file: C:\Users\Maikel\Documents\PowerShell_transcript.MAIKEL-LAPTOP.ZeXOSYfF.20220619212311.txt

 

When opening the file you can find the commands back in this file.