Advanced Windows PowerShell Scripting Video Training

Advanced Windows PowerShell Scripting Video Training
Advanced Windows PowerShell Scripting Video Training

Wednesday, October 3, 2012

PowerShell Transcript

Have you ever worked on trying to figure out how to get a specific chuck of data out from deep within an object, only to forget how you did it once you found it. Or maybe you need to back track you steps but the screens veritcle buffer is full so you cannot see what you are doing? Try using PowerShell’s transcript capability. It is very easy to use. Just type Start-Transcript in the shell. It will save the transcript file to your Documents folder. When you are finished, or want to start a new log, just type Stop-Transcript. Below is a quick example. You will not see the Start-Transcript command in the log file because the log file is opened after the command is typed.

The ISE does not have the Start-Transcript cmdlet. Here is an article from the Scripting Guy to help you get the same capability in the ISE.

**********************

Windows PowerShell transcript start

Start time: 20120810103917

Username : Jason-PC\Jason

Machine : JASON-PC (Microsoft Windows NT 6.1.7601 Service Pack 1)

**********************

Transcript started, output file is C:\Users\Jason\Documents\PowerShell_transcript.20120810103917.txt

PS C:\Users\Jason> cls

PS C:\Users\Jason> get-service

Status Name DisplayName

------ ---- -----------

Stopped AdobeFlashPlaye... Adobe Flash Player Update Service

Stopped AeLookupSvc Application Experience

Running ALG Application Layer Gateway Service

Stopped AppIDSvc Application Identity

Running Appinfo Application Information

…. Section removed for brevity ….

Running WSearch Windows Search

Running wuauserv Windows Update

Running wudfsvc Windows Driver Foundation - User-mo...

Stopped WwanSvc WWAN AutoConfig

PS C:\Users\Jason> Stop-Transcript

**********************

Windows PowerShell transcript end

End time: 20120810104259

**********************

No comments: