Friday, November 25, 2011

Capture your PowerShell Commands

Use the start-transcript PowerShell command to capture all the commands that you type. This can be very useful when you made a mistake or to save PowerShell code afterwards. For example:
Start Powershell
At the command prompt, type:


Start-Transcript C:\Temp\PSCapture.txt
{this command need a filename to store you session data}


Now, type any command:

Get-Service


And:


Get-Service | Get-member


Then, stop the transcript:

Stop-Transcript

Now you can browse to the C:\Temp\PSCapture.txt to view the commands log

No comments: