Script to check profile paths in AD

Dear all,

We are currently moving all profiles from one server to another but i need to check which users in active directory still have there profile paths set to the old server.

Do anyone have a script that could show me a print out of who still have there profile path set to the old server?

Thanks,

Lyon
LVL 3
LyonJayAsked:
Who is Participating?
 
Krzysztof PytkoConnect With a Mentor Senior Active Directory EngineerCommented:
You can simply use Microsoft DS Tools. On a DC or workstation with Administrative Tools/RSAT installed type in command-line:

dsquery user -name * -limit 0 | dsget user -fn -ln -samid -hmdir | find /i "oldServerName"

Regards,
Krzysztof
0
 
Glen KnightConnect With a Mentor Commented:
how about something like:

CSVDE -f C:\PROFILES.CSV -l "profilepath"

This will export the DN and the profile path to a CSV file.
0
 
LyonJayAuthor Commented:
Where would i run them querys from?

Thanks,

Lyon
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
Glen KnightCommented:
both from a command prompt.
0
 
Krzysztof PytkoSenior Active Directory EngineerCommented:
it's also good example :)

There is many ways for that :) PowerShell, CSVDE, LDIFDE, DS Tools, ADFind aso.
Usage depends on user preferences, I prefer using DS Tools :)

Krzysztof
0
 
LyonJayAuthor Commented:
Thanks guy!

Will have a go and get back to you!
0
 
LyonJayAuthor Commented:
demazter,

your query just errored out.

Thanks,

Lyon
0
 
Glen KnightCommented:
possibly you don't have permissions to C:

take the c:\ off.

Try:

CSVDE -f PROFILES.CSV -l "profilepath"
0
 
Glen KnightCommented:
the -l is a lowercase L not an i.
0
 
LyonJayAuthor Commented:
That didnt work.

Thanks,

Lyon
0
 
Glen KnightCommented:
odd, what's the error you are getting?
0
 
Krzysztof PytkoSenior Active Directory EngineerCommented:
and where you are typing this command? I would suggest doing that on a DC :)

Krzysztof
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.