Export (0) Print
Expand All

FileSystemSecurity::RemoveAuditRule Method (FileSystemAuditRule)

Removes all matching allow or deny audit rules from the current file or directory.

Namespace:  System.Security.AccessControl
Assembly:  mscorlib (in mscorlib.dll)

bool RemoveAuditRule(
	FileSystemAuditRule^ rule


Type: System.Security.AccessControl::FileSystemAuditRule

A FileSystemAuditRule object that represents an audit rule to remove from a file or directory.

Return Value

Type: System::Boolean
true if the audit rule was removed; otherwise, false


The rule parameter is nullptr.

The RemoveAuditRule method removes either all matching Deny audit rules or all matching Allow audit rules from the current FileSystemSecurity object. For example, you can use this method to remove all Deny audit rules for a user by passing a FileSystemAuditRule object created using the Deny value, the Failure value, and a user account. When you do this, the RemoveAuditRule method removes any deny rules that specify the Failure value or the Success value.

The following code example uses the AddAuditRule method to add an audit rule to a file and uses the RemoveAuditRule method to remove the audit rule from the file. You must supply a valid user or group account to run this example.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft