Skip to content

Disable SqlDscAudit

dscbot edited this page Mar 3, 2024 · 2 revisions

Disable-SqlDscAudit

SYNOPSIS

Disables a server audit.

SYNTAX

ServerObject

Disable-SqlDscAudit -ServerObject <Server> -Name <String> [-Force] [-Refresh]
 [-WhatIf] [-Confirm] [<CommonParameters>]

AuditObject

Disable-SqlDscAudit -AuditObject <Audit> [-Force] [-WhatIf] [-Confirm]
 [<CommonParameters>]

DESCRIPTION

This command disables a server audit in a SQL Server Database Engine instance.

EXAMPLES

EXAMPLE 1

$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$auditObject = $sqlServerObject | Get-SqlDscAudit -Name 'MyFileAudit'
$auditObject | Disable-SqlDscAudit

Disables the audit named MyFileAudit.

EXAMPLE 2

$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$sqlServerObject | Disable-SqlDscAudit -Name 'MyFileAudit'

Disables the audit named MyFileAudit.

PARAMETERS

-AuditObject

Specifies an audit object to disable.

Type: Audit
Parameter Sets: AuditObject
Aliases:

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

-Force

Specifies that the audit should be disabled without any confirmation.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-Name

Specifies the name of the server audit to be disabled.

Type: String
Parameter Sets: ServerObject
Aliases:

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

-Refresh

Specifies that the ServerObject's audits should be refreshed before trying to disable the audit object. This is helpful when audits could have been modified outside of the ServerObject, for example through T-SQL. But on instances with a large amount of audits it might be better to make sure the ServerObject is recent enough, or pass in AuditObject.

Type: SwitchParameter
Parameter Sets: ServerObject
Aliases:

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

-ServerObject

Specifies current server connection object.

Type: Server
Parameter Sets: ServerObject
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
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

General

Commands

Clone this wiki locally