Home Folders showing as My Documents

I have seen some similar questions for this I know i can just delete desktop.ini for each folder manually

Is there a working powershell or batch file thats safe to use for this?

I have tried GPO workaround without success

User Configuration > Preferences > Windows Settings > Files (set to delete) and then put in desktop.ini

Suppress errors on individual file actions’ > Common Tab > Tick ‘Run in logged-on-users’s security context (user policy option)’ > Apply > OK

Would prefer either a script or gpo than a file screen if possible, most of our customers use One Drive, haven't seen this for a while thanks


Solution 1:

The best solution to the issue of seeing lots of folders called "My Documents" because of desktop.ini on your file server, is to store them in a subfolder of the username.

If you redirect "My Documents" folders to \\svr\users$\%username% this causes the problem.

The path may be \\svr\users$\IrishGuy101 but when you browse the users$ share, even on the local file system of svr, it will display as "My Documents" because of desktop.ini.

A better practice is to redirect "My Documents" folders to \\svr\users$\%username%\Documents.

Now your path becomes \\svr\users$\IrishGuy101\Documents and it shows as "My Documents" only after you've browsed from the users$ share one level deeper into the IrishGuy101 folder.

You can also redirect other folders into this user folder, such as Desktop and have Documents and Desktop in the same user folder.

If for some reason doing this differently isn't an option right now, you can use a powershell command to do a recursive delete in the users share. (That sentence should be terrifying.)

Get-ChildItem * -Include "desktop.ini" -Recurse should display all the desktop.ini files from each user share. Once that looks good to delete, you can pipe the output to Remove-Item

Get-ChildItem * -Include "desktop.ini" -Recurse | Remove-Item