Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8887205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:44:58+00:00 2026-06-14T21:44:58+00:00

I am trying to apply audit rules with this code function add-acl($Right,$Access) { $audit

  • 0

I am trying to apply audit rules with this code

function add-acl($Right,$Access)
{
$audit = "mydomain\myaccount","$Right","containerinherit","none","$Access"
$r = new-object system.security.accesscontrol.registryauditrule $audit
$acl.addauditrule($r)
}

$acl = get-acl hklm:\software\_test
add-acl "CreateSubKey" "Success"
add-acl "Delete" "Success"  
add-acl "Delete" "Failure"  
$acl | set-acl

but this code writes audit rules without taking account of earlier rules.
So I wanted to retrieve audit rules before applying the code.
To do so, I used the method getauditrules() :

$acl.getauditrules($true,$true,??)

In ?? position, I tried NTaccount object and windowsSecurity. It doesn’t return an error and in fact does not return something at all. This is really disapointing because while using windows interface, I can see that an audit rule is applied.
I don’t understand what type of object is expecting the getauditrules() method.
Can someone help me ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:44:59+00:00Added an answer on June 14, 2026 at 9:44 pm

    Try adding the -audit paramenter to get-acl cmdlet ( this retrieve SACL , System Access Control List).

    $acl = get-acl hklm:\software\_test -audit
    

    the you can use:

    $acl.getauditrules($true,$true, [System.Security.Principal.NTAccount] )
    

    or

    $acl.getauditrules($true,$true, [System.Security.Principal.SecurityIdentifier] )
    

    based on your goal.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im trying to apply this JSON code to my Google Map: [ { stylers:
I'm trying to apply border-radius effect on a particular div. The code I used
I am trying to apply smoothing filter to image . But I get this
I'm trying to do a django-south migration to an existing application to add django-audit-log
Trying to apply a 301 redirect to this url /Qx%40w%2C6M42VAwp3%40Rb%7B~cC4ure%60QWI9 but it's not liking
Im trying to apply different background color to even and odd items in a
i'm trying to apply the MVVM pattern in my application with MVVM Light. I've
I am trying to apply global application styles to certain control types, however adding
I'm trying to apply contrast and brightness to a bitmap in memory and I'm
I am trying to apply filters to employees to show them just on the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.