-
Notifications
You must be signed in to change notification settings - Fork 225
New‑SqlDscAudit
Creates a server audit.
New-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>]
New-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>]
New-SqlDscAudit -ServerObject <Server> -Name <String> [-AuditFilter <String>] [-OnFailure <String>]
[-QueueDelay <UInt32>] [-AuditGuid <String>] [-Force] [-Refresh] [-PassThru] -Path <String>
-MaximumRolloverFiles <UInt32> [-WhatIf] [-Confirm] [<CommonParameters>]
New-SqlDscAudit -ServerObject <Server> -Name <String> [-AuditFilter <String>] [-OnFailure <String>]
[-QueueDelay <UInt32>] [-AuditGuid <String>] [-Force] [-Refresh] [-PassThru] -Path <String>
-MaximumFiles <UInt32> [-ReserveDiskSpace] [-WhatIf] [-Confirm]
[<CommonParameters>]
New-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>]
New-SqlDscAudit -ServerObject <Server> -Name <String> [-AuditFilter <String>] [-OnFailure <String>]
[-QueueDelay <UInt32>] [-AuditGuid <String>] [-Force] [-Refresh] [-PassThru] -Path <String>
[-WhatIf] [-Confirm] [<CommonParameters>]
New-SqlDscAudit -ServerObject <Server> -Name <String> [-AuditFilter <String>] [-OnFailure <String>]
[-QueueDelay <UInt32>] [-AuditGuid <String>] [-Force] [-Refresh] [-PassThru] -LogType <String>
[-WhatIf] [-Confirm] [<CommonParameters>]
This command creates a server audit on a SQL Server Database Engine instance.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$sqlServerObject | New-SqlDscAudit -Name 'MyFileAudit' -Path 'E:\auditFolder'
Create a new file audit named MyFileAudit.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$sqlServerObject | New-SqlDscAudit -Name 'MyAppLogAudit' -LogType 'ApplicationLog'
Create a new application log audit named MyAppLogAudit.
$serverObject = Connect-SqlDscDatabaseEngine -InstanceName 'MyInstance'
$sqlServerObject | New-SqlDscAudit -Name 'MyFileAudit' -Path 'E:\auditFolder' -PassThru
Create a new file audit named MyFileAudit 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 that the audit should be created 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 log location where the audit should write to. This can be SecurityLog or ApplicationLog.
Type: String
Parameter Sets: Log
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the number of files on disk.
Type: UInt32
Parameter Sets: FileWithSizeAndMaxFiles, FileWithMaxFiles
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.
Type: UInt32
Parameter Sets: FileWithSizeAndMaxRolloverFiles, FileWithSizeAndMaxFiles, FileWithSize
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 set to Megabyte
,
Gigabyte
, or Terabyte
.
Type: String
Parameter Sets: FileWithSizeAndMaxRolloverFiles, FileWithSizeAndMaxFiles, FileWithSize
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: FileWithSizeAndMaxRolloverFiles, FileWithMaxRolloverFiles
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 added.
Type: String
Parameter Sets: (All)
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 created 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: FileWithSizeAndMaxRolloverFiles, FileWithSizeAndMaxFiles, FileWithMaxRolloverFiles, FileWithMaxFiles, FileWithSize, File
Aliases:
Required: True
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 ServerObject's audits should be refreshed before creating 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.
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: FileWithSizeAndMaxFiles, FileWithMaxFiles
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: (All)
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 medium since an audit is created but by default is is not enabled.
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