Transcripts

The ability to create transcripts of your PowerShell activity is great for keeping track of what you’ve done. They are also very useful when testing as you can keep a record of your results. 

There’s one problem though – transcripts don’t work in the ISE.  Try this in PowerShell 4.0 or earlier:

Start-Transcript -Path C:\Temp\tran1.txt
Get-Process
Stop-Transcript

You’ll get an error like this:

Start-Transcript : This host does not support transcription.
At line:1 char:1
+ Start-Transcript -Path C:\Temp\tran1.txt
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotImplemented: (:) [Start-Transcript], PSNotSup
   portedException
    + FullyQualifiedErrorId : NotSupported,Microsoft.PowerShell.Commands.Start
   TranscriptCommand

Your script will run then you’ll get another error:

Stop-Transcript : This host does not support transcription.
At line:3 char:1
+ Stop-Transcript
+ ~~~~~~~~~~~~~~~
    + CategoryInfo          : NotImplemented: (:) [Stop-Transcript], PSNotSupp
   ortedException
    + FullyQualifiedErrorId : NotSupported,Microsoft.PowerShell.Commands.StopT
   ranscriptCommand

 

Now try the same in PowerShell 5.0 and you’ll get this:

Transcript started, output file is C:\Temp\tran1.txt

 

Your script will run and you’ll see this at the end:

Transcript stopped, output file is C:\Temp\tran1.txt

 

Your transcript file will will be created and contain the desired output.

Another useful addition to your PowerShell tool kit – transcripts now work in ISE

Advertisements
This entry was posted in PowerShell v5. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s