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 9102247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:20:08+00:00 2026-06-17T01:20:08+00:00

Having trouble getting the output I want from some powershell commands. I’m creating a

  • 0

Having trouble getting the output I want from some powershell commands. I’m creating a powershell script to help clean up home directories. I need to get the permissions of the directory and make sure that the name of the directoy and the user who has access match.

I’m using the Get-Acl function and it has alot of extra data. In theory the file permissions on these directories should have Administrators as the owner, the user should be the only person listed under Access.

PS C:\> Get-Acl "\\fs1\home\e55555"
Directory: \\fs1\home
Path                       Owner                      Access
----                       -----                      ------
e55555                    BUILTIN\Administrators     DOM\e55555 Allow ...

I would like to filter out everything except what is under access. I tried piping | select Access but it doesn’t give me the same output.

I know I’ll have extra information besides the UserID so I figured I could write to a file and try to “grep” what I needed. Through some googling and experimentation I got some output I felt would be easy to parse, here is the command and output:

PS C:\> $test = Get-Acl \\fs1\home\\e55555 | Select-Object -ExpandProperty Access
 | select IdentityReference

IdentityReference
-----------------
DOM\e55555
NT AUTHORITY\SYSTEM
BUILTIN\Administrators
NT AUTHORITY\Authenticated Users

Tried to use regex to find the line I wanted, none of the things I tried gave me any output. I tried different variations of the commands below and also tried parsing a file instead of a variable:

echo $test | Select-String -pattern "^DOM"
[regex]::matches($test,"^DOM")

So how can I trim down my output on my get-acl command? And how can I “grep” for any lines starting with DOM without extra data?

  • 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-17T01:20:09+00:00Added an answer on June 17, 2026 at 1:20 am

    This should give you the access-objects for all users in your domain

    $path = "\\fs1\home\\e55555"
    (Get-Acl $path).Access | where { $_.IdentityReference -like "DOM*"}
    

    If you want to check that user is in there, you could use:

    $path = "\\fs1\home\\e55555"
    $username = $path | Split-Path -Leaf
    
    (Get-Acl $path).Access | where { $_.IdentityReference -like "DOM\$username"}
    

    I didn’t extract the Identityreference property since you need the whole access object if you want to check the permissions. If you save the Get-Acl outputs to a variable (ex. $access = Get-Acl ......), you can check that the user had a access rule by using if($access) { do something }

    EDIT: Just as an idea. If you only want the folders where a user with the same name as the folder doesn’t have an access rule(without checking what kind of rights the user has), you could try:

    $acls = Get-ChildItem "\\fs1\home\" | Get-Acl 
    foreach ($acl in $acls) {
        $users = $acl.Access | select -ExpandProperty IdentityReference
        $username = $acl.PSChildName
        if ($users -notcontains "DOM\$username") { $username }
    }
    

    This should output an array of foldernames(ex. “e55555”) where something IS wrong(ex. user “e55555” doesn’t have any access to the folder “e55555”).

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

Sidebar

Related Questions

I'm having trouble finding/getting any logging output from a web service. I have a
I'm having trouble getting the Xml output to file that I expect. I want
for some reason I'm having trouble getting output with this form.. I have a
im having trouble getting a string (containing a URL) from one activity to another.
I'm having trouble getting a UIView to respond how I want with multiple touches.
I'm having trouble getting a clojure defmacro to do what I want. I've reduced
I am having some trouble using grep to output a list of phrases matching
Having trouble getting my POST arrays to show all checkbox values from my form.
I'm having trouble getting my content script to communicate with my background page. I'm
I am having trouble getting this to work. What I want to do is

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.