O'Reilly logo

SQL Server 2012 with PowerShell V3 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

Running and saving a profiler trace event

In this recipe, we will run and save a profiler trace event using PowerShell.

Getting ready

To run and save a profiler trace event, we will need to use the x86 version of PowerShell and/or PowerShell ISE. This is unfortunate, but some of the classes we need to use are only supported in 32-bit mode.

In this recipe, we will need to use the standard trace Template Definition File (TDF) as our starting template for the trace we're going to run. This can be found in C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Profiler\Templates\Microsoft SQL Server\110\Standard.tdf

For our purposes, we are also going to limit the number of events to 50.

How to do it...

  1. Open the PowerShell console by going to Start

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