How to revert renamed user homefolders to My Documents

Today I had this weird problem because of some stupid brain farts by the Microsoft developers team.
When you redirect the my documents folder to a network location let’s say \\servername\sharename\%username% then the %username% looks like it is renamed to my documents, FOR EVERY USER!)
So you’ll have a folder with in my case hundreds of my documents folders..

You definitely don’t want this behaviour!

Apparently this is by design http://support.microsoft.com/kb/947222.
When you take a look at this article you really want to choose between creating a subfolder under the redirected folder in the Universal Naming Convention (UNC) path.

For example, the following UNC path: \\server\users\username\Documents

The best method is the third one from the article: Do not grant the Read permission to the administrator for the Desktop.ini files on the server.

To do this, follow these steps:
Note If more than one Desktop.ini file exists, follow these steps for all the Desktop.ini files.
Right-click the Desktop.ini file, click Properties, and then click the Security tab.
In the Group or user names pane, click Administrators.
Click to select the Deny check box for the Read permission.
Click OK.

You can also use this great PowerShell scipt:
$folders = Get-ChildItem | where-object {$_.psiscontainer};

foreach ($folder in $folders)
{
$ErrorActionPreference = "SilentlyContinue"
$desktopIni = Get-ChildItem $folder -Filter desktop.ini -Force

if ($desktopIni -ne $null)
{
$Acl = (Get-Item $desktopIni.FullName -Force).GetAccessControl("Access")
$Ar = New-Object system.security.accesscontrol.filesystemaccessrule `
("groupName","Read","Deny")
$Acl.SetAccessRule($Ar)
Set-Acl $desktopIni.FullName $Acl
}
}

Thanx to this great blog by Richard Willis!!

Advertisements

Posted on 16/11/2010, in Windows. Bookmark the permalink. Leave a comment.

Comments are closed.

%d bloggers like this: