Powershell Get-ADUser not showing homedrive and homedirectory

I am trying to query a couple OUs in our AD environment to find out home directories and home drives for our users.

I've tried a couple variations, and I get output of most of the properties of user accounts in the same OU, so I know I can read the properties.  However the Homedrive and homedirectory properties show with no values whether I specifically look for those properties or choose to view all of the properties of the users.   If I look in AD Users and Computers at the Profile tab for many of the users I do see a drive and UNC path listed for them.  What is awry?

Get-ADUser  -SearchBase "OU=Users,OU=CityOU,DC=CompanyDC=Com" -filter * -Properties * | Select Name,samAccountName,homedrive, homedirectory

Running a DSQuery on users yields the same problem.  It shows other property values but nothing listed in homedirectory and homedrive.
DarthywAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

alicainCommented:
Hi!

Do you get the same result if you explicitly target each DC? Using the -server switch ?

Regards,
Alastair.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DarthywAuthor Commented:
Thanks Alastair, that seemed to help.  Oddly, now I'm getting this error when searching one set of OUs and sub-OUs

"Get-ADUser : Cannot find the requested object.
At line:1 char:1
+ Get-ADUser  -server server1 -SearchBase "OU=East,OU=City,DC=Company,DC=Co ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-ADUser], CryptographicException
    + FullyQualifiedErrorId : Cannot find the requested object.
,Microsoft.ActiveDirectory.Management.Commands.GetADUser"
 

I've narrowed it down to one sub-OU of only user accounts.  No matter which server I try I seem to get this same error after listing the same few users in the output.  There are about 50 users in the OU.  I'm wondering if one of the user objects is corrupted, but is there a way to narrow it down.

I have another group of OUs on which this works fine after adding the -Server and -SearchScope parameters
0
alicainCommented:
It might be time to
Do you get the same result if you use an -LDAPFilter instead?

Have you tried using another other tool such as LDP.EXE, ADSIEdit.msc, ADExplorer or ADFind to see if you get similar results or can see any problems with objects in this OU?

Some health checks with DCDiag and Repadmin to ensure things are OK would be worth doing. :
http://technet.microsoft.com/en-us/library/cc758753(v=ws.10).aspx
http://technet.microsoft.com/en-us/library/cc835092.aspx

Would be worth checking to see if there has there been any changes to the permissions on that OU that and the objects below it.

Hope that helps,
Alastair.
0
DarthywAuthor Commented:
Sorry for the delay in points.  I've been busy with a huge project.  Adding the server switch fixed my original issue .  As for the OU query that was erroring out, I even had issues with DSQuery which makes me think perhaps there is  a user account in AD with an issue in this one OU.  We've migrated those users to a new domain, so I doubt I'll work too hard to look at it now as I've got plenty else to do.  Thanks.
0
alicainCommented:
Hi, no worries, good to hear that it helped narrow things down.  Yes it does sound like there is something odd with one or more users in that OU.
If the domain is going to stay for use by other users, a bit of a health check would be prudent.

Regards,
Alastair.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2008

From novice to tech pro — start learning today.