SharePoint Tip: Next time you are in PowerShell record your commands to a text file for future use.
PowerShell is a very powerful tool for deploying and configuring SharePoint. Sometimes getting the commands right can take some time and the script may need to run on another environment. Recording your PowerShell scripts to a text file can help you create scripts for future use. Below are the commands to record and stop recording a PowerShell script.
Start-Transcript
There are two ways to start recording a PowerShell session as seen below:
start-transcript
This command starts a transcript in the default file location.
or
start-transcript -path c:scriptsscript1.txt
This command starts a transcript in the script1.txt file in C:scripts.
Stop-Transcript
To stop recording a PowerShell session run the following command:
stop-transcript
This command stops any running transcripts.
For more information on the Start-Transcript and Stop-Transcript commands please visit http://technet.microsoft.com/en-us/library/hh849687.aspx and http://technet.microsoft.com/en-us/library/hh849688.aspx.