Solved

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

Posted on 2011-03-04
5
2,592 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Mapping Drives using Group policy preferences Are you still using old scripts to map your network drives if so this article will show you how to get away for old scripts and move toward Group Policy Preference for mapping them. First things f…
Introduction You may have a need to setup a group of users to allow local administrative access on workstations.  In a domain environment this can easily be achieved with Restricted Groups and Group Policies. This article will demonstrate how to…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

707 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now