-
Notifications
You must be signed in to change notification settings - Fork 225
Set SqlDscAudit
Updates a server audit.
Set-SqlDscAudit -ServerObject <Server> -Name <String> [-AuditFilter <String>] [-OnFailure <String>]
[-QueueDelay <UInt32>] [-AuditGuid <String>] [-Force] [-Refresh] [-PassThru] [-Path <String>]
-MaximumFileSize <UInt32> -MaximumFileSizeUnit <String> -MaximumRolloverFiles <UInt32>
[-WhatIf] [-Confirm] [<CommonParameters>]
Set-SqlDscAudit -ServerObject <Server> -Name <String> [-AuditFilter <String>] [-OnFailure <String>]
[-QueueDelay <UInt32>] [-AuditGuid <String>] [-Force] [-Refresh] [-PassThru] [-Path <String>]
-MaximumFileSize <UInt32> -MaximumFileSizeUnit <String> -MaximumFiles <UInt32> [-ReserveDiskSpace]
[-WhatIf] [-Confirm] [<CommonParameters>]
Set-SqlDscAudit -ServerObject <Server> -Name <String> [-AuditFilter <String>] [-OnFailure <String>]
[-QueueDelay <UInt32>] [-AuditGuid <String>] [-Force] [-Refresh] [-PassThru] [-Path <String>]
-MaximumRolloverFiles <UInt32> [-WhatIf] [-Confirm] [<CommonParameters>]
Set-SqlDscAudit -ServerObject <Server> -Name <String> [-AuditFilter <String>] [-OnFailure <String>]
[-QueueDelay <UInt32>] [-AuditGuid <String>] [-Force] [-Refresh] [-PassThru] [-Path <String>]
-MaximumFiles <UInt32> [-ReserveDiskSpace] [-WhatIf] [-Confirm]
[<CommonParameters>]
Set-SqlDscAudit -ServerObject <Server> -Name <String> [-AuditFilter <String>] [-OnFailure <String>]
[-QueueDelay <UInt32>] [-AuditGuid <String>] [-Force] [-Refresh] [-PassThru] [-Path <String>]
-MaximumFileSize <UInt32> -MaximumFileSizeUnit <String> [-WhatIf]
[-Confirm] [<CommonParameters>]
Set-SqlDscAudit -ServerObject <Server> -Name <String> [-AuditFilter <String>] [-OnFailure <String>]
[-QueueDelay <UInt32>] [-AuditGuid <String>] [-Force] [-Refresh] [-PassThru] [-Path <String>]
[-WhatIf] [-Confirm] [<CommonParameters>]
Set-SqlDscAudit -AuditObject <Audit> [-AuditFilter <String>] [-OnFailure <String>] [-QueueDelay <UInt32>]
[-AuditGuid <String>] [-Force] [-Refresh] [-PassThru] [-Path <String>] -MaximumFileSize <UInt32>
-MaximumFileSizeUnit <String> -MaximumRolloverFiles <UInt32> [-WhatIf]
[-Confirm] [<CommonParameters>]
Set-SqlDscAudit -AuditObject <Audit> [-AuditFilter <String>] [-OnFailure <String>] [-QueueDelay <UInt32>]
[-AuditGuid <String>] [-Force] [-Refresh] [-PassThru] [-Path <String>] -MaximumFileSize <UInt32>
-MaximumFileSizeUnit <String> -MaximumFiles <UInt32> [-ReserveDiskSpace]
[-WhatIf] [-Confirm] [<CommonParameters>]
Set-SqlDscAudit -AuditObject <Audit> [-AuditFilter <String>] [-OnFailure <String>] [-QueueDelay <UInt32>]
[-AuditGuid <String>] [-Force] [-Refresh] [-PassThru] [-Path <String>] -MaximumRolloverFiles <UInt32>
[-WhatIf] [-Confirm] [<CommonParameters>]
Set-SqlDscAudit -AuditObject <Audit> [-AuditFilter <String>] [-OnFailure <String>] [-QueueDelay <UInt32>]
[-AuditGuid <String>] [-Force] [-Refresh] [-PassThru] [-Path <String>] -MaximumFiles <UInt32>
[-ReserveDiskSpace] [-WhatIf] [-Confirm] [<CommonParameters>]
Set-SqlDscAudit -AuditObject <Audit> [-AuditFilter <String>] [-OnFailure <String>] [-QueueDelay <UInt32>]
[-AuditGuid <String>] [-Force] [-Refresh] [-PassThru] [-Path <String>] -MaximumFileSize <UInt32>
-MaximumFileSizeUnit <String> [-WhatIf] [-Confirm] [<CommonParameters>]
Set-SqlDscAudit -AuditObject <Audit> [-AuditFilter <String>] [-OnFailure <String>] [-QueueDelay <UInt32>]
[-AuditGuid <String>] [-Force] [-Refresh] [-PassThru] [-Path <String>]
[-WhatIf] [-Confirm] [<CommonParameters>]
This command updates and existing server audit on a SQL Server Database Engine instance.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$sqlServerObject | Set-SqlDscAudit -Name 'MyFileAudit' -Path 'E:\auditFolder' -QueueDelay 1000
Updates the file audit named MyFileAudit by setting the path to ''E:\auditFolder' and the queue delay to 1000.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$sqlServerObject | New-SqlDscAudit -Name 'MyAppLogAudit' -QueueDelay 1000
Updates the application log audit named MyAppLogAudit by setting the queue delay to 1000.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$sqlServerObject | Set-SqlDscAudit -Name 'MyFileAudit' -Path 'E:\auditFolder' -QueueDelay 1000 -PassThru
Updates the file audit named MyFileAudit by setting the path to ''E:\auditFolder' and the queue delay to 1000, and returns the Audit object.
Specifies the filter that should be used on the audit. See predicate expression how to write the syntax for the filter.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the GUID found in the mirrored database. To support scenarios such as database mirroring an audit needs a specific GUID.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies an audit object to update.
Type: Audit
Parameter Sets: AuditObjectWithSizeAndMaxRolloverFiles, AuditObjectWithSizeAndMaxFiles, AuditObjectWithMaxRolloverFiles, AuditObjectWithMaxFiles, AuditObjectWithSize, AuditObject
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Specifies that the audit should be updated without any confirmation.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Specifies the number of files on disk.
Type: UInt32
Parameter Sets: ServerObjectWithSizeAndMaxFiles, ServerObjectWithMaxFiles, AuditObjectWithSizeAndMaxFiles, AuditObjectWithMaxFiles
Aliases:
Required: True
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
Specifies the maximum file size in units by parameter MaximumFileSizeUnit. Minimum allowed value is 2 (MB). It also allowed to set the value to 0 which mean unlimited file size.
Type: UInt32
Parameter Sets: ServerObjectWithSizeAndMaxRolloverFiles, ServerObjectWithSizeAndMaxFiles, ServerObjectWithSize, AuditObjectWithSizeAndMaxRolloverFiles, AuditObjectWithSizeAndMaxFiles, AuditObjectWithSize
Aliases:
Required: True
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
Specifies the unit that is used for the file size. this can be KB, MB or GB.
Type: String
Parameter Sets: ServerObjectWithSizeAndMaxRolloverFiles, ServerObjectWithSizeAndMaxFiles, ServerObjectWithSize, AuditObjectWithSizeAndMaxRolloverFiles, AuditObjectWithSizeAndMaxFiles, AuditObjectWithSize
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the amount of files on disk before SQL Server starts reusing the files. If not specified then it is set to unlimited.
Type: UInt32
Parameter Sets: ServerObjectWithSizeAndMaxRolloverFiles, ServerObjectWithMaxRolloverFiles, AuditObjectWithSizeAndMaxRolloverFiles, AuditObjectWithMaxRolloverFiles
Aliases:
Required: True
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
Specifies the name of the server audit to be updated.
Type: String
Parameter Sets: ServerObjectWithSizeAndMaxRolloverFiles, ServerObjectWithSizeAndMaxFiles, ServerObjectWithMaxRolloverFiles, ServerObjectWithMaxFiles, ServerObjectWithSize, ServerObject
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies what should happen when writing events to the store fails. This can be 'Continue', 'FailOperation', or 'Shutdown'.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
If specified the changed audit object will be returned.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Specifies the location where te log files wil be placed.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the maximum delay before a event is written to the store. When set to low this could impact server performance. When set to high events could be missing when a server crashes.
Type: UInt32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
Specifies that the audit object should be refreshed before updating. 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.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Specifies if the needed file space should be reserved. To use this parameter the parameter MaximumFiles must also be used.
Type: SwitchParameter
Parameter Sets: ServerObjectWithSizeAndMaxFiles, ServerObjectWithMaxFiles, AuditObjectWithSizeAndMaxFiles, AuditObjectWithMaxFiles
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Specifies current server connection object.
Type: Server
Parameter Sets: ServerObjectWithSizeAndMaxRolloverFiles, ServerObjectWithSizeAndMaxFiles, ServerObjectWithMaxRolloverFiles, ServerObjectWithMaxFiles, ServerObjectWithSize, ServerObject
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
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
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
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
This command has the confirm impact level set to high since an audit is unknown to be enable at the point when the command is issued.
See the SQL Server documentation for more information for the possible parameter values to pass to this command: https://docs.microsoft.com/en-us/sql/t-sql/statements/create-server-audit-transact-sql
- Add-SqlDscNode
- Add-SqlDscTraceFlag
- Complete-SqlDscFailoverCluster
- Complete-SqlDscImage
- Connect-SqlDscDatabaseEngine
- ConvertFrom-SqlDscDatabasePermission
- ConvertFrom-SqlDscServerPermission
- ConvertTo-SqlDscDatabasePermission
- ConvertTo-SqlDscServerPermission
- Disable-SqlDscAudit
- Disconnect-SqlDscDatabaseEngine
- Enable-SqlDscAudit
- Get-SqlDscAudit
- Get-SqlDscConfigurationOption
- Get-SqlDscDatabasePermission
- Get-SqlDscManagedComputer
- Get-SqlDscManagedComputerService
- Get-SqlDscPreferredModule
- Get-SqlDscServerPermission
- Get-SqlDscStartupParameter
- Get-SqlDscTraceFlag
- Import-SqlDscPreferredModule
- Initialize-SqlDscRebuildDatabase
- Install-SqlDscServer
- Invoke-SqlDscQuery
- New-SqlDscAudit
- Remove-SqlDscAudit
- Remove-SqlDscNode
- Remove-SqlDscTraceFlag
- Repair-SqlDscServer
- Save-SqlDscSqlServerMediaFile
- Set-SqlDscAudit
- Set-SqlDscDatabasePermission
- Set-SqlDscServerPermission
- Set-SqlDscStartupParameter
- Set-SqlDscTraceFlag
- Test-SqlDscIsDatabasePrincipal
- Test-SqlDscIsLogin
- Test-SqlDscIsSupportedFeature
- Uninstall-SqlDscServer
- SqlAG
- SqlAGDatabase
- SqlAgentAlert
- SqlAgentFailsafe
- SqlAgentOperator
- SqlAGListener
- SqlAGReplica
- SqlAlias
- SqlAlwaysOnService
- SqlAudit
- SqlConfiguration
- SqlDatabase
- SqlDatabaseDefaultLocation
- SqlDatabaseMail
- SqlDatabaseObjectPermission
- SqlDatabasePermission
- SqlDatabaseRole
- SqlDatabaseUser
- SqlEndpoint
- SqlEndpointPermission
- SqlLogin
- SqlMaxDop
- SqlMemory
- SqlPermission
- SqlProtocol
- SqlProtocolTcpIp
- SqlReplication
- SqlRole
- SqlRS
- SqlRSSetup
- SqlScript
- SqlScriptQuery
- SqlSecureConnection
- SqlServiceAccount
- SqlSetup
- SqlTraceFlag
- SqlWaitForAG
- SqlWindowsFirewall