You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: public/ConvertTo-DbaXESession.ps1
+27-3Lines changed: 27 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,13 @@ function ConvertTo-DbaXESession {
21
21
Specifies the name for the new Extended Events session. If a session with this name already exists, the function automatically appends the trace ID or a random number to avoid conflicts.
22
22
Choose a descriptive name that identifies the monitoring purpose, as this becomes the session name visible in SQL Server Management Studio and sys.server_event_sessions.
23
23
24
+
.PARAMETERSqlCredential
25
+
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
26
+
27
+
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
28
+
29
+
For MFA support, please use Connect-DbaInstance.
30
+
24
31
.PARAMETEROutputScriptOnly
25
32
Returns the T-SQL CREATE EVENT SESSION script without executing it on the server. Use this when you need to review the generated script before deployment or save it for later execution.
26
33
Particularly useful in compliance environments where all scripts require approval before running against production databases.
@@ -63,6 +70,7 @@ function ConvertTo-DbaXESession {
63
70
[object[]]$InputObject,
64
71
[parameter(Mandatory)]
65
72
[string]$Name,
73
+
[PSCredential]$SqlCredential,
66
74
[switch]$OutputScriptOnly,
67
75
[switch]$EnableException
68
76
)
@@ -87,13 +95,22 @@ function ConvertTo-DbaXESession {
87
95
$tempdb=$server.Databases['tempdb']
88
96
$traceid=$trace.id
89
97
90
-
if ((Get-DbaXESession-SqlInstance $server-Session $PSBoundParameters.Name)) {
0 commit comments