Solved

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

Posted on 2011-03-04
5
2,680 Views
Last Modified: 2012-05-11
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

0
Comment
Question by:ncomper
5 Comments
 
LVL 10

Expert Comment

by:cjrmail2k
ID: 35037655
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...
0
 
LVL 3

Expert Comment

by:IamTheMorsa
ID: 35037723
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.
1
 
LVL 26

Accepted Solution

by:
farhankazi earned 500 total points
ID: 35038239
On Windows 2003 command-line copy and paste following line. This will generate UserList.txt file on C drive root.

Above statement uses Windows 2003 built-in tool called DSQuery thus does not require Powershell or any third-party executable.

Hope this helps!
Farhan

DSQuery * -Filter "(&((objectCategory=Person)(objectClass=User)(homeDirectory=\\server01\Users\*)))" -Attr samAccountName Name -Limit 0 >UserList.txt

Open in new window

0
 
LVL 5

Author Comment

by:ncomper
ID: 35056278
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
0
 
LVL 5

Author Closing Comment

by:ncomper
ID: 35056318
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
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Last week, our Skyport webinar on “How to secure your Active Directory” (https://www.experts-exchange.com/videos/5810/Webinar-Is-Your-Active-Directory-as-Secure-as-You-Think.html?cid=Gene_Skyport) provided 218 attendees with a step-by-step guide for…
This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question