Hey, everyone. I’m trying to do a simple active directory search to create a list of all the “users” in the domain . The issue is that I’m stuck with Powershell 1.0 and I’m not able to install any modules (so things like Get-ADUser are a no-go for me). I’m a little new at all of this - I’m sort of teaching myself. I’ve tried a few different methods with little luck. Anyone out there that can give me some ideas to start off with? I’ve tried:
$root = [ADSI]
$searcher = New-Object System.DirectoryServices.DirectorySearcher($root)
$searcher.filter = “(objectClass=user)”
$searcher.FindAll()
##Result - I get a list that doesn’t appear to include all users in the domain, and it includes the LDAP path…all I need is names. So, I try adding this final line:
$searcher.FindAll() | for-eachobject {$_.properties[“name”]} | sort
#Result - Now, this appears to provide me a list sorted alphabetically. However, when I checked the accuracy of the list, it was missing “users”. Anyone have any ideas that may help? Thanks in advance to anyone willing to help me out!