Skip to content

Commit 9338719

Browse files
committed
Filter out null and zero values from trace flags in Get-SqlDscTraceFlag for accurate results; ensure valid trace flags start at 1.
1 parent db894d3 commit 9338719

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

source/Public/Get-SqlDscTraceFlag.ps1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,12 @@ function Get-SqlDscTraceFlag
7373

7474
$traceFlags = [System.UInt32[]] @()
7575

76-
if ($startupParameter)
76+
if ($startupParameter -and $startupParameter.TraceFlag)
7777
{
78-
$traceFlags = $startupParameter.TraceFlag
78+
# Filter out null and zero values (nulls get converted to 0 in UInt32 arrays).
79+
# Valid trace flags start at 1.
80+
$traceFlags = $startupParameter.TraceFlag |
81+
Where-Object -FilterScript { $_ -ne 0 }
7982
}
8083

8184
Write-Debug -Message (

0 commit comments

Comments
 (0)