How can I make a PowerShell transcript log everything I do?
Admins can create PowerShell transcripts to log everything they do. The PowerShell Console host -- the blue window launched from the Windows Start menu or Start screen -- supports the creation of transcripts. Just run Start-Transcript and provide a filename, and everything you run in that window will be captured, including command output. Transcripts are per-runspace, which means that each new PowerShell window will have to have its own transcript. Close the window or run Stop-Transcript to close the file.
Any runspace that uses the Console window can use a transcript, and that includes the Exchange Management Shell, SharePoint Management Shell and whatever other "management shell" shortcuts you've got. Those all run PowerShell.exe -- the Console host -- and have pre-loaded scripts and add-ins.
By contrast, the PowerShell Integrated Scripting Environment (ISE) does not support transcripts. Other hosting applications (think commercial script editors) may not either. With those hosting applications, they need to provide their own logging mechanism since the ISE has none; otherwise, you're out of luck.
If you get into Remoting, the rules get a bit odd.
When you interactively remote into a machine using Enter-PSSession, the remote machine cannot keep a transcript or a PowerShell transcript. That's because the hosting application on the remote machine doesn't do transcripts. But your machine can keep a transcript of whatever commands you send to the remote machine and the output that comes back. With remoting, you're not really using a SecureShell (SSH) type of connection. You're still typing on your local console; complete commands are sent to the remote machine for execution and results are deserialized into your local console.
About the author
Don Jones is a well-known and respected PowerShell expert and educator. He's co-author of three books on PowerShell (see PowerShellBooks.com for a list). You can find his content online, including his PowerShell Q&A forums, by visiting DonJones.com.
Dig deeper on Windows PowerShell Scripting
Related Q&A from Don Jones, Contributor
If you don't need a GUI display, PowerShell can be hosted in several hosting applications so you can use cmdlets instead of a graphical input prompt.continue reading
With some simple configuration, admins can run a PowerShell script each time a computer starts with the help of the Task Scheduler GUI and cmdlets.continue reading
Each PowerShell version has different features made useful by add-ins and snap-ins, so admins have to pay attention to what features work where.continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.