Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2011-03-04
5
Medium Priority
?
2,824 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:
Farhan Kazi earned 2000 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

Uncontrolled local administrators groups within any organization pose a huge security risk. Because these groups are locally managed it becomes difficult to audit and maintain them.
How to deal with a specific error when using the Enable-RemoteMailbox cmdlet to create a mailbox in the cloud-based service, for an existing user in an on-premises 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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

782 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