O'Reilly logo

SQL Server 2014 with PowerShell v5 Cookbook by Donabel Santos

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Extracting the contents of a trace file

In this recipe, we will extract the contents of a trace (.trc) file using PowerShell.

Getting ready

We will need to use the x86 Version of PowerShell and/or PowerShell ISE for this recipe. This is unfortunate, but some of the classes that we need to use are only supported in 32-bit mode.

In this recipe, we will use a previously saved trace (.trc) file. Feel free to substitute this with a trace file that is available.

How to do it...

Let's take a look at how we can extract the contents of a trace file:

  1. Open PowerShell ISE as an administrator.
  2. Import the SQLPS module:
    #import SQL Server module
    Import-Module SQLPS -DisableNameChecking
  3. Import additional libraries. These are needed to use our TraceFile and TraceServer ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required