Udostępnij za pośrednictwem


Właściwość Audit.DestinationType

Pobiera lub ustawia typ obiekt docelowy, do którego rejestrowane informacje dziennika inspekcji, takich jak plik lub dziennika aplikacji.

Przestrzeń nazw:  Microsoft.SqlServer.Management.Smo
Zestaw:  Microsoft.SqlServer.Smo (w Microsoft.SqlServer.Smo.dll)

Składnia

'Deklaracja
<SfcPropertyAttribute(SfcPropertyFlags.Standalone)> _
Public Property DestinationType As AuditDestinationType
    Get
    Set
'Użycie
Dim instance As Audit
Dim value As AuditDestinationType

value = instance.DestinationType

instance.DestinationType = value
[SfcPropertyAttribute(SfcPropertyFlags.Standalone)]
public AuditDestinationType DestinationType { get; set; }
[SfcPropertyAttribute(SfcPropertyFlags::Standalone)]
public:
property AuditDestinationType DestinationType {
    AuditDestinationType get ();
    void set (AuditDestinationType value);
}
[<SfcPropertyAttribute(SfcPropertyFlags.Standalone)>]
member DestinationType : AuditDestinationType with get, set
function get DestinationType () : AuditDestinationType
function set DestinationType (value : AuditDestinationType)

Wartość właściwości

Typ: Microsoft.SqlServer.Management.Smo.AuditDestinationType
A AuditDestinationType obiekt reprezentujący typ obiekt docelowy, do którego jest rejestrowane informacje dziennika inspekcji.

Przykłady

Następujący kod ilustruje przykład sposobu zestaw typu miejsca docelowego inspekcji w dzienniku zdarzeń zabezpieczeń systemu Windows.

C#

using System;
using Microsoft.SqlServer.Management.Smo;

namespace samples
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create the audit and set the destination file type
            Server dbServer = new Server("(local)");
            Audit dbAudit = new Audit(dbServer, "Test Audit");
            dbAudit.DestinationType = AuditDestinationType.SecurityLog;
            dbAudit.FilePath = "C:\\AuditDirectory";
            dbAudit.Create();
        }
    }
}

PowerShell

#Create the audit
$dbServer = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$dbAudit = New-Object Microsoft.SqlServer.Management.Smo.Audit($dbServer, "Test Audit")
$dbAudit.DestinationType = [Microsoft.SqlServer.Management.Smo.AuditDestinationType]'File'
$dbAudit.FilePath = "C:\AuditDirectory"
$dbAudit.Create()