Click an Ad

If you find this blog helpful, please support me by clicking an ad!

Friday, February 21, 2014

Where are my users' mapping their My Documents folder?

We don't have folder redirection enabled on my domain. Long-term, we'd like to get this put in place, but at some point in time some users' folder were manually redirected. Maybe.

Furthermore, in my project of eradicating Windows XP from the network I have run across instances where users were saving things to their "My Documents" folder (which isn't redirected) instead of to their mapped personal drive (which is the file server that gets backed up). It's a miracle that people haven't lost more data!

What I've done is created a Powershell login script (my first) that collects some key pieces of information and writes to a file on a wide-open share.

What this process ultimately does is place a file on an open share that has a filename like this:

COMPUTERNAME - DocFolder - SizeOfFiles

The IF statement at the bottom checks the existence of a marker file. If the file doesn't exist, the process continues and creates the marker file. Otherwise, nothing happens. This is so the login script only creates a file on the open share once per user.

The part that I had to research was how to run a Powershell script on logon. Thankfully, The Scripting Guy had a very helpful post. I even learned about WMI filters along the way!

I'm not going to regurgitate his steps to you. They are clear-cut enough.

Since I'm going to create this marker-file within users' MyDocs folders, when I've collected all the data I need and it's time to unlink this GPO, I'll need to alter the script to delete the marker-file if it exists.

Another tidbit: Powershell logon scripts only run on Windows 7, and not Windows XP logins. I don't know about Vista; we don't run it.