Roaming Profiles - AD Attribute

I am stuck.

I am trying to put together a termination script for former employees.

The issue is that we use gpo's to redirect their profiles to different servers.  One other issue is that when a user's username changes (ie married, divorced, etc), we continue to redirect their roaming profile to the old profile created under the original user account.

I have tried using the following AD attributes:
msTSProfilePath
msTSHomeDirectory
ProfilePath
psbase.InvokeGet("terminalservicesHomeDirectory")
psbase.InvokeGet("terminalservicesprofilepath")

The above all show as blank.  

If we manually input the users information in AD under Remote Desktop Services Profile, the correct information is only shown under psbase.InvokeGet("terminalservicesHomeDirectory") and psbase.InvokeGet("terminalservicesprofilepath")

Is there an AD attribute that holds the current roaming profile and roaming home directory information even if that location is redirected based on a GPO?


***The purpose of the script is to find a user's roaming profiles and roaming home directory on a file server and then to move those folders to an archive server after the user is no longer with us.
mrfiteAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

yo_beeDirector of Information TechnologyCommented:
Profile path information is under HomeDirectory Attribute, but the Redirection information is set at the GPO Level.  For you to find there users Redirected Folders you would need to read the HKCU Hive
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
There you will find where each folder is directed to.

So the first part is doable using
Get-ADUSER -Filter * -Properties HomeDirectory | Select Name, Homedirectory.  

Open in new window

The second part might be a bit more difficult, but could be done if the structure of the folder hierarchy is similar .

ie.  
Roaming Profile:  \\server01\Profile\somename\
Redirected Folder: \\Server01\Folders\Somename\

If that is the case you can take the Somename part from the Homedirectory  string and concatenate  '\\Server01\Folders\' +  $somename

Is this something that sounds like a process that would work?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Active Directory

From novice to tech pro — start learning today.

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.