dbatools is a free PowerShell module with over 200 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


Copy-DbaAuditSpecification

Migrates audit specifications from one SQL Server to another. By default, all audit specifications are copied. The -AuditSpecifications parameter is autopopulated for command-line completion and can be used to copy only specific audit specifications.

If the audit specification already exists on the destination, it will be skipped unless -Force is specified. Force drops and recreates the audit specification.

Examples

To copy all audit specifications from sqlserver2014a to sqlcluster, using integrated (WIndows) authentication. If audit specifications with the same name exist on sqlcluster, they will be skipped.

 

To copy only two audit specifications, LoginAuditSpecs and TableModAuditSpecs, from sqlserver2014a to sqlcluster, using SQL audit specifications for sqlserver2014a and Windows audit specifications for sqlcluster. If an audit specification with the same name exists on sqlcluster, it will be dropped and recreated because -Force was used.

 

To see what would happen if the command were executed without actually performing an actions are actually performed.

 

Get-Help

From PowerShell, execute Get-Help Copy-DbaAuditSpecification -Detailed for more information on this function.

Source Code

Want to see the source code? View Copy-DbaAuditSpecification.ps1 on GitHub
 

Related commands