Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

AD HomeDirectory Help!

AD HomeDirectory Help!

AD HomeDirectory Help!

I am writing a script to pull all the users who has a homedirectory on a certain server using a wild card.  It runs and no errors but it exports nothing and doesn't run long.
Any assistance would be appreciated:


$csvfile = "C:\Scripts\Home-Dir-Lookup.csv"

Get-QADUser -SizeLimit 0 -SearchRoot "ou=Ccntr-J,OU=Region Coastal,OU=Central Division,DC=home,DC=com,DC=com" -HomeDirectory *'
-ObjectAttributes @{homeDirectory='\\fla*'} -IncludeAllProperties |'
Select-Object LogonName,HomeDirectory |
Export-Csv $csvfile

RE: AD HomeDirectory Help!

I'm not well versed at powershell but looking at your syntax it looks like you made a possible typo.It should be DC=home , dc=com  not DC=home, dc=com , dc=com.There could be something else but I caught that possible error while reading your script.   

RE: AD HomeDirectory Help!

I have removed the second dc=com and receive
    + CategoryInfo          : NotSpecified: (:) [Get-QADUser], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Quest.ActiveRoles.ArsPowerShellSnapIn.Powershell.Cmdlets.GetUserCmdlet

RE: AD HomeDirectory Help!

First I would try running that command in segments in my console window, to see if you get any output.  

Break it down:

Get-QADUser -SizeLimit 0 -SearchRoot "ou=Ccntr-J,OU=Region Coastal,OU=Central Division,DC=home,DC=com,DC=com"

If you don't get all of the users in the Cost-Center-J OU here, Stop and fix the errors.  I think your formatting looks strange on the OU name.  Try changing the DC=Home to OU=Home.  You only use DC= for your the name of the domain.

Furthermore, if you're having trouble on the formatting of your Distinguished Names for your OU's, try this, replacing the text in -like "Your_OU_name_Here" with the OU you want.

get-qadobject -Type 'organizationalUnit' | ? {$_.Name -like "Your_OU_Name_Here*"}

You can copy the output from this to get the correct formatting of your OU's Distinguished Name.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close