Skip to content

Add SqlDscTraceFlag

dscbot edited this page Mar 3, 2024 · 2 revisions

Add-SqlDscTraceFlag

SYNOPSIS

Add trace flags to a Database Engine instance.

SYNTAX

ByServerName (Default)

Add-SqlDscTraceFlag [-ServerName <String>] [-InstanceName <String>] -TraceFlag <UInt32[]> [-Force]
 [-WhatIf] [-Confirm] [<CommonParameters>]

ByServiceObject

Add-SqlDscTraceFlag -ServiceObject <Service> -TraceFlag <UInt32[]> [-Force]
 [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

Add trace flags on a Database Engine instance, keeping any trace flags currently set.

EXAMPLES

EXAMPLE 1

Add-SqlDscTraceFlag -TraceFlag 4199

Adds the trace flag 4199 on the Database Engine default instance on the server where the command in run.

EXAMPLE 2

$serviceObject = Get-SqlDscManagedComputerService -ServiceType 'DatabaseEngine'
Add-SqlDscTraceFlag -ServiceObject $serviceObject -TraceFlag 4199

Adds the trace flag 4199 on the Database Engine default instance on the server where the command in run.

EXAMPLE 3

Add-SqlDscTraceFlag -InstanceName 'SQL2022' -TraceFlag 4199,3226

Adds the trace flags 4199 and 3226 on the Database Engine instance 'SQL2022' on the server where the command in run.

EXAMPLE 4

$serviceObject = Get-SqlDscManagedComputerService -ServiceType 'DatabaseEngine' -InstanceName 'SQL2022'
Add-SqlDscTraceFlag -ServiceObject $serviceObject -TraceFlag 4199,3226

Adds the trace flags 4199 and 3226 on the Database Engine instance 'SQL2022' on the server where the command in run.

PARAMETERS

-Force

Specifies that the trace flag should be added without any confirmation.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-InstanceName

Specifies the instance name on which to remove the trace flags.

Type: String
Parameter Sets: ByServerName
Aliases:

Required: False
Position: Named
Default value: MSSQLSERVER
Accept pipeline input: False
Accept wildcard characters: False

-ServerName

Specifies the server name where the instance exist.

Type: String
Parameter Sets: ByServerName
Aliases:

Required: False
Position: Named
Default value: (Get-ComputerName)
Accept pipeline input: False
Accept wildcard characters: False

-ServiceObject

Specifies the Service object on which to add the trace flags.

Type: Service
Parameter Sets: ByServiceObject
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-TraceFlag

Specifies the trace flags to add.

Type: UInt32[]
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

None.

NOTES

RELATED LINKS

Home

Commands

Resources

Usage

Clone this wiki locally