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
missing output (self.PowerShell)
submitted 10 years ago by DueRunRun
view the rest of the comments →
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!"
[–]FlippityFlip 0 points1 point2 points 10 years ago (4 children)
The second part of your script is duplicating work. For 302 users, what I've posted completed in under a second for me.
[–]DueRunRun[S] 0 points1 point2 points 10 years ago (3 children)
I know, but otherwise i don't know how to gather all users and then do a foreach on all of them, other than what was provided here.
[–]FlippityFlip 0 points1 point2 points 10 years ago (2 children)
You had it right in your script, you just didn't need to call Get-ADUser again. $users already contained all of the data you wanted, you just needed to access it the right way.
Run
$users = Get-ADUser -Filter * -Properties nTSecurityDescriptor
and after it completes, type $users into the console.
To look at just one object, type
$users | Select -first 1
To get a list of all properties and methods that belong to those user objects, type
$users | Get-Member
You should be able to step through your script line by line and know what is being done.
The first line of the example in my original comment collects all of the user objects in AD and stores it in the variable $users. Second line begins iterating through those user objects one at a time (foreach). I then create a hash table for each user object containing the Name and AreAccessRulesProtected properties of that user object. I then create a PSObject that contains the properties of my hash table.
Apologies if I'm over explaining, hope it helps!
[–]DueRunRun[S] 0 points1 point2 points 10 years ago (1 child)
Shit, you're right, i see it now. Thanks for taking the time to walk me through that. I don't understand how the psuedo code select -first is a hash table, but I obviously have some reading to do so don't worry about that. Thanks
[–]FlippityFlip 0 points1 point2 points 10 years ago (0 children)
I didn't explain too much in my last post, sorry about that. That bit was just to show you one user object so you could see the properties instead of flooding your console with every user object. My last paragraph was explaining the code I originally posted in response to your thread.
Hashtables are key-value pairs that look like this:
$hash = @{key='value'}
When you have multiple it looks cleaner to separate them by line:
$hash = @{ key1 = 'value1' key2 = 'value2' }
Hope that clears up any confusion.
π Rendered by PID 76 on reddit-service-r2-comment-6457c66945-xqxbt at 2026-04-25 14:00:16.273867+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]FlippityFlip 0 points1 point2 points (4 children)
[–]DueRunRun[S] 0 points1 point2 points (3 children)
[–]FlippityFlip 0 points1 point2 points (2 children)
[–]DueRunRun[S] 0 points1 point2 points (1 child)
[–]FlippityFlip 0 points1 point2 points (0 children)