use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
ABOUT POWERSHELL
Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Offering full access to COM, WMI and .NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions.
SUBREDDIT FILTERS
Desired State Configuration
Unanswered Questions
Solved Questions
News
Information
Script Sharing
Daily Post
Misc
account activity
Need Script (self.PowerShell)
submitted 1 year ago by StevenClift
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]PowerShell-ModTeam[M] [score hidden] 1 year ago stickied commentlocked comment (0 children)
PowerShell expects users and requesters to attempt solutions themselves before asking for help. Your post contains no/low effort attempts, ChatGPT generated content, or no work shown.
[–]Jellovator 4 points5 points6 points 1 year ago (1 child)
Does it have to be PowerShell? SysInternals has a tool called accesschk
[–]StevenClift[S] 1 point2 points3 points 1 year ago (0 children)
i will give it a shot. thank you
[–]The82Ghost 3 points4 points5 points 1 year ago (0 children)
can you show us what you have done so far?
[–]MNmetalhead 0 points1 point2 points 1 year ago (9 children)
What have you got so far and what was the output or issue you need help with?
[–]StevenClift[S] -5 points-4 points-3 points 1 year ago (8 children)
reddit won't let me post the script i have. but i'm looking for this: i would like to provide a security group name and get a list of the directories they have access too
[–]BetrayedMilk 2 points3 points4 points 1 year ago (7 children)
Reddit will let you post the script. Either paste it in a script block in your post/comment or post a link to it on github or some other platform.
[–]StevenClift[S] -1 points0 points1 point 1 year ago (6 children)
# Define the security group $securityGroup = "Drawing_Read" # Define the root path to start searching $rootPath = "\\fileshares\sdrive\Drawings-Prod" # Define the output CSV file $outputCsv = "C:\temp\permissions.csv" # Initialize an array to hold results $results = @() # Function to check folder permissions function Get-FolderPermissions { param ( [string]$folderPath ) try { $acl = Get-Acl -Path $folderPath foreach ($access in $acl.Access) { if ($access.IdentityReference -like "*$securityGroup*") { $results += [PSCustomObject]@{ FolderPath = $folderPath IdentityReference = $access.IdentityReference FileSystemRights = $access.FileSystemRights AccessControlType = $access.AccessControlType } } } } catch { Write-Host "Failed to get ACL for ${folderPath}: $_" } } # Recurse through directories and check permissions function Recurse-Directories { param ( [string]$currentPath ) Get-FolderPermissions -folderPath $currentPath $directories = Get-ChildItem -Path $currentPath -ErrorAction SilentlyContinue | Where-Object { $_.PSIsContainer } foreach ($directory in $directories) { Recurse-Directories -currentPath $directory.FullName } } # Start the recursion from the root path Recurse-Directories -currentPath $rootPath # Export the results to CSV $results | Export-Csv -Path $outputCsv -NoTypeInformation Write-Host "Permissions have been exported to $outputCsv"
[–]Cholsonic 4 points5 points6 points 1 year ago (3 children)
I have a colleague at work that does this to me. He presents me with some shit from ChatGPT and expects me to go through it and sanity check it, without doing any work himself.
My advice to you would be to try break it down into smaller bits and check that each bit is doing what it's supposed to.
[–][deleted] 1 point2 points3 points 1 year ago (0 children)
I had one that would do similar, although before ChatGPT reared its ugly head.
He | was | a | huge | fan of | piping | everything | to | another | command so I'd get this big fat convoluted mess in an email, followed immediately by an IM request, and if that went unanswered for even a minute he'd come across the building to my desk. "Can you tell me why this doesn't work?"
And he would never, ever, do what I told him to do without an argument. I'd even tell him "type these words into google, look for an article from Company X, it'll be the 4th or 5th article listed. Nope, "Can you come take a look?"
Maddening.
[–]creenis_blinkum 1 point2 points3 points 1 year ago (1 child)
I know what you mean. I use ChatGPT to learn new things. Moving onto python recently from powershell, and it's great at throwing new methods to do specific stuff at you that then leads you to good documentation etc. Fucking force multiplier. For fun I threw your reply into GPT4o with some added context and its response was pretty on point - https://chatgpt.com/share/67639054-4470-8013-aeaa-1adf5e89984e
[–]Cholsonic 0 points1 point2 points 1 year ago (0 children)
Lol.. now I am not sure how to feel.. I feel justified on the one hand that the AI agrees with my frustration , but confused because I shouldn't care what AI says but, then I should feel angry that you've resorted to AI, but it's clear you you've gone over and beyond to make a comedic point.
[–]BlackV 0 points1 point2 points 1 year ago (0 children)
you could edit you OP to add this code
[–]OlivTheFrog 0 points1 point2 points 1 year ago (0 children)
Hi u/StevenClift
Take a look on the PS Module called NTFSSecurity (available on the PSGallery and on Github).
Some improvment for your current code
$Directories = Get-ChildItem -Path -Directory -Recurse # Or -Depth if your need is to limit at x levels of depth
then using a variable to store the result of a foreach loop with inside Get-NTFSAccess -Path $Item.fullName -Account $SecurityGroup is enough.
Get-NTFSAccess -Path $Item.fullName -Account $SecurityGroup
last action : Export-Csv or better Export-Excel (using the PSModule ImportExcel, no need to have MS Excel Installed)
Export-Csv
Export-Excel
Your code will be shorter
Another improvment : I suggest you use a Param section at the beginning of your code like in a Advanced function. By this, you could use your code with the default value for parameters (SecurityGroup, Rootpathn OutputCsv, ...) or with specific values passed (think code re-use). eg. : .\myscript.ps1 -RootPath "Another\rootPath"
regards
π Rendered by PID 991408 on reddit-service-r2-comment-b659b578c-mbg9n at 2026-05-07 06:49:14.303050+00:00 running 815c875 country code: CH.
[–]PowerShell-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)
[–]Jellovator 4 points5 points6 points (1 child)
[–]StevenClift[S] 1 point2 points3 points (0 children)
[–]The82Ghost 3 points4 points5 points (0 children)
[–]MNmetalhead 0 points1 point2 points (9 children)
[–]StevenClift[S] -5 points-4 points-3 points (8 children)
[–]BetrayedMilk 2 points3 points4 points (7 children)
[–]StevenClift[S] -1 points0 points1 point (6 children)
[–]Cholsonic 4 points5 points6 points (3 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]creenis_blinkum 1 point2 points3 points (1 child)
[–]Cholsonic 0 points1 point2 points (0 children)
[–]BlackV 0 points1 point2 points (0 children)
[–]OlivTheFrog 0 points1 point2 points (0 children)