Share via


Script an Extended Event Session

This topic describes how to script an event session. You can export, alter, or drop the event session, or drop and create the event session to the following:

  • New Query Editor Window

  • File

  • Clipboard

  • Agent Job

To script an existing event session

  1. In Object Explorer, expand the Management node, and then expand Extended Events.

  2. Right-click the session you want to script, point to Script Session as, point to CREATE to, and then select where you want to script the session.

To script a new event session

  1. In Object Explorer, expand the Management node, and then expand Extended Events.

  2. Right-click Sessions, and then click New Session.

  3. In the New Session UI, create the event session, and then select where you want to script the event session from the Script drop-down list.

To script a modified event session

  1. In Object Explorer, expand the Management node, and then expand Extended Events.

  2. Right-click the session you want to modify, and then click Properties.

  3. In the Session Properties dialog box, modify the event session, and then select where you want to script the modified session from the Script drop-down list.

See Also

Concepts

Extended Events