Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

Server.ServerAuditSpecifications Property


Represents a collection of ServerAuditSpecification objects. Each ServerAuditSpecification object represents a specific audit specification defined on the instance of SQL Server.

Namespace:   Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

    SfcContainerCardinality.ZeroToAny, typeof(ServerAuditSpecification))>]
member ServerAuditSpecifications : ServerAuditSpecificationCollection with get

Property Value

Type: Microsoft.SqlServer.Management.Smo.ServerAuditSpecificationCollection

A ServerAuditSpecificationCollection object that represents all the audit specifications defined on the instance of SQL Server.


Server srv = new Server("(local)");

ServerAuditSpecification aSpec = new ServerAuditSpecification(srv, "Example Audit Specification");
Audit srvAudit = new Audit(srv, "Test Audit");
srvAudit.DestinationType = AuditDestinationType.File;
srvAudit.FilePath = "C:\\AuditDirectory";

aSpec.AuditName = "Test Audit";

foreach (ServerAuditSpecification a in srv.ServerAuditSpecifications)


$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$srvAudit = new-object Microsoft.SqlServer.Management.Smo.Audit($srv, "Test Audit")
$srvAudit.DestinationType = [Microsoft.SqlServer.Management.Smo.AuditDestinationType]::File
$srvAudit.FilePath = "C:\AuditDirectory"

Foreach ($a in $srv.ServerAuditSpecifications)
   Write-Host $a.Name
Return to top
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft