Hello from a Powershell newbie!
I’ve had a look around but not found exaclty what I’m looking for so thought I’d post. I’m trying to use this simple script to extract a first and last name for each user in a given OU. I want to list each user in each OU in my AD tree but so far, I cant get it to work correctly. Any help is greatly appreciated ![]()
code : Get-ADUser -searchbase “ou=xxxxxx,ou=xxx xxx,ou=xxxx,dc=mydomain,dc=com” -filter * -Properties Department
The error I get is:
Get-ADUser : Directory object not found
At line:1 char:11
- get-Aduser <<<< -searchbase "ou=xxxxxxx,ou=xxx xxxx,ou=xxxxx,dc=mydomain,dc=com" -filter * -properties Departme
nt- CategoryInfo : ObjectNotFound: (
[Get-ADUser], ADIdentityNotFoundException - FullyQualifiedErrorId : Directory object not found,Microsoft.ActiveDirectory.Management.Commands.GetADUser
- CategoryInfo : ObjectNotFound: (
I"m really not sure whats wrong here so really appreciate your time!
Thanks and Regards