다음을 통해 공유


ServerAuditSpecifications 속성

ServerAuditSpecification 개체의 컬렉션을 나타냅니다. 각 ServerAuditSpecification 개체는 SQL Server 인스턴스에 정의된 특정 감사 사양을 나타냅니다.

네임스페이스:  Microsoft.SqlServer.Management.Smo
어셈블리:  Microsoft.SqlServer.Smo(Microsoft.SqlServer.Smo.dll)

구문

‘선언
<SfcObjectAttribute(SfcContainerRelationship.ObjectContainer, SfcContainerCardinality.ZeroToAny,  _
    GetType(ServerAuditSpecification))> _
Public ReadOnly Property ServerAuditSpecifications As ServerAuditSpecificationCollection
    Get
‘사용 방법
Dim instance As Server
Dim value As ServerAuditSpecificationCollection

value = instance.ServerAuditSpecifications
[SfcObjectAttribute(SfcContainerRelationship.ObjectContainer, SfcContainerCardinality.ZeroToAny, 
    typeof(ServerAuditSpecification))]
public ServerAuditSpecificationCollection ServerAuditSpecifications { get; }
[SfcObjectAttribute(SfcContainerRelationship::ObjectContainer, SfcContainerCardinality::ZeroToAny, 
    typeof(ServerAuditSpecification))]
public:
property ServerAuditSpecificationCollection^ ServerAuditSpecifications {
    ServerAuditSpecificationCollection^ get ();
}
[<SfcObjectAttribute(SfcContainerRelationship.ObjectContainer, SfcContainerCardinality.ZeroToAny, 
    typeof(ServerAuditSpecification))>]
member ServerAuditSpecifications : ServerAuditSpecificationCollection
function get ServerAuditSpecifications () : ServerAuditSpecificationCollection

속성 값

유형: Microsoft.SqlServer.Management.Smo. . :: . .ServerAuditSpecificationCollection
SQL Server 인스턴스에 정의된 모든 감사 사양을 나타내는 ServerAuditSpecificationCollection 개체입니다.

C#

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";
srvAudit.Create();

aSpec.AuditName = "Test Audit";
aSpec.Create();

foreach (ServerAuditSpecification a in srv.ServerAuditSpecifications)
{
   Console.WriteLine(a.Name);
}

PowerShell

$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"
$srvAudit.Create()

Foreach ($a in $srv.ServerAuditSpecifications)
{
   Write-Host $a.Name
}