Link to home
Start Free TrialLog in
Avatar of ncomper
ncomper

asked on

Export list of users who have specific unc path in home folder attribute

Hi All

I am looking for a script that can search our domain and export only users that have \\server01\Users\ in the path for the Home folder attribute  (Not Local Path)

If it could export the SamAccountName, full Homefolder path and the chosen drive letter thats in the drop down

Our AD is Windows 2003 level with all DC's at Win 2003 SP2 (not R2)

Is this possible

Thanks

Avatar of cjrmail2k
cjrmail2k
Flag of United Kingdom of Great Britain and Northern Ireland image

I would suggest trying joeware's adfind (www.joeware.net) although you may need to export the attributes for all into excel and sort in excel. Have a look though as I remember it was a really powerful tool last time I used it...
Avatar of IamTheMorsa
IamTheMorsa

If you can use powershell, here is the scripts you need:

First type this
import-module ActiveDirectory

Press Enter

Now cut and pastes this:

Get-ADUser -Filter * -SearchBase "DC=YOUR_DOMAIN,DC=COM" -Properties * | Select-Object SamAccountName,GivenName,Surname,DisplayName,HomeDirectory | export-csv -path AllADUsers_v3.csv -NoTypeInformation -Encoding "UTF8"

Change the DC line to match your domain.

Open up your cvs vile, make a filter on the first line and then you can sort the HomeDirectory field.
ASKER CERTIFIED SOLUTION
Avatar of Farhan Kazi
Farhan Kazi
Flag of Australia image

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 ncomper

ASKER

Thanks

You got me on the right path, when i ran that it wasnt displaying correctly but i modified it to the below and its working well

DSQuery * -Filter "(&((objectCategory=Person)(objectClass=User)(homeDirectory=\5c\5cserver01\5cusers\5c*)))" -Attr samAccountName Name homeDirectory -limit 0 >c:\Users.txt


Thanks again

Nick
Avatar of ncomper

ASKER

DSQuery * -Filter "(&((objectCategory=Person)(objectClass=User)(homeDirectory=\5c\5cserver01\5cusers\5c*)))" -Attr samAccountName Name homeDirectory -limit 0 >c:\Users.txt

Modified slightly to this but 99.99% there.

Thanks