IAuditSecurity Interface

Inherited from

IDispatch

IUnknown

Applies to Objects

ObjectSecurity

The IAuditSecurity interface is useful in the management of System Audit Access Control Lists (SACLs) for Windows securable objects such as NTFS files and directories, the registry, and attached printers. You can use methods of the IAuditSecurity interface to get audit information such as audit permissions assigned to various users and groups, and whether auditing is specified for a particular trustee.

Property/Method

Description

AttachFile

Initializes File audit security

AttachPrinter

Initializes Printer object audit security

AttachRegistryKey

Initializes Registry Key audit security

GetAccessAudit

Gets the audit permissions for a specified trustee

GetAccessList

Gets the (audit) access control list for a trustee

GetEffectiveAudit

Gets the audit permissions for a trustee. If the trustee is a user, it gets the effective permissions this user gets as a result of being a member of various Groups

IsAuditSet

Checks if auditing is set for the specified user or group. The permission string specifies the type of auditing to be checked

SetAccessAudit

Sets the audit permissions for a specified trustee

SetAccessFailAudit

Sets the specified "access failed" audit permission for a specified trustee

SetAccessSuccessAudit

Sets the specified "access success" audit permission for a specified trustee

Remarks
Attach: To use the functionality provided by IAuditSecurity, you need to first attach the securable object of Windows. This can be done using the AttachXXXX functions of IAuditSecurity.

Reuse: Once the audit security object is created, you can attach different securable objects to it such as files, directories, registry keys and printers. At a given time, you can have only one securable object attached to an ObjectSecurity object.

Example

'To initialize the file audit security
Dim auditSec As IAuditSecurity
Set auditSec = CreateObject("DirectScript.ObjectSecurity")
'If D:\ is a NTFS volume
auditSec.AttachFile("d:\myfiles\foo.doc")
'Get/set audit properties of this file
'Attach another file. Connection to the earlier file is lost auditSec.AttachFile("d:\myfiles\AnotherFoo.doc")
'Get/set audit properties of this file
'Attach Printer. Connection to the earlier file is lost
auditSec.AttachPrinter("\\lion\PrintFoo")
'Get/set audit properties of this printer
'Attach Registry key. Connection to printer lost
auditSec.AttachRegistryKey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft")
'Get/set audit properties of this key