Recently I began taking on the task of moving the file share and user folders from one drive to another. The share wasn’t so much of a problem because I use DFS, so I just pointed the DFS back to the new share folder. All is good. I figured that I would give this a shot with my user folders and map them using Group Policy. Not so good.
It started with not being able to redirect to a server share without having the share indexed. I then found out that I can’t index a DFS folder. Which made that solution impossible. I’m come to terms now that I can’t redirect documents via DFS. So, I started out on the journey of mapping them through Group Policy, which I’ve done before. Once I had that set up everything was working great. Wrong.
Being as caring as I am I noticed that C:\Users\Public was also mapped in Documents along with the server version. I don’t want users saving to that folder so I had to come up with a solution to remove that folder. Surprising to me, Group Policy does not have that option, so off to Google I went. I found a few ‘make your own policies’ options through hacking the registry, which I was fine with, until I read the disclaimer that it cannot be undone simply by removing the policy, so that was off the table.
Then I ran across a comment about using PowerShell and since I love PowerShell and automation I figured this would be a reasonable solution. I found this site that I have used before to solve my problem. After downloading the ‘Windows 7 Library’ I extracted the folder and signed the .psm1 script that was in there (see older posts). Once I did that I created a startup script that consists of:
PS >Import-Module C:\Users\test\Desktop\Wnidows7Library\Windows7Library.psm1
PS>Remove-LibraryFolder -LibraryPath (Get-KnownFolder “DocumentsLibrary”).path -FolderPath “C:\users\public\documents”
Once I ran that command at start-up the C:\Users\Public folder was gone. So, next I deployed the script through Group Policy and all has been good since.