Link to home
Start Free TrialLog in
Avatar of Darthyw
Darthyw

asked on

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.
ASKER CERTIFIED SOLUTION
Avatar of alicain
alicain

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Darthyw
Darthyw

ASKER

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
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.
Avatar of Darthyw

ASKER

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.
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.