Pages

Saturday, November 02, 2013

Delete File Paths that are "Too Long"

It's bound to happen sooner or later. You go to delete a directory and instead get an error message to the effect of "I'm sorry, this file path is far too long so you can't do anything with it."

One way to overcome this is to use robocopy, a command line tool that comes standard in any modern version of Windows.


  1. Open a command prompt (Start->Run->cmd)
  2. Navigate to the parent of the directory you want to delete (cd [path])
    e.g. if you want to delete C:\dev\example\toolongdirroot\, navigate to C:\dev\example\
  3. Make an empty directory (mkdir .\emptydir)
  4. Use robocopy to mirror the empty directory to the toolongdirroot (robocopy .\emptydir .\toolongdir /mir)
  5. Congratulations, you did it! Delete emptydir and toolongdir and you're done!


Saturday, October 19, 2013

How to Map Network Drives with Group Policy

It seems that while this should be a simple, straight forward task, it's not. I've always needed to set a few things that weren't mentioned in the Microsoft knowledge base article.

I have had success with these settings with both Windows Server 2008 and 2008 R2 hosting Active Directory (AD) with both Windows 7 and Windows 8 clients.

tl;dr version

  • User Configuration -> Preferences -> Windows Settings -> Drive Maps -> [add desired mappings]
  • Computer Configuration -> Policies -> Administrative Templates -> System -> Group Policy ->User Group Policy loopback processing mode -> Enabled
  • User Configuration -> Preferences -> Windows Settings -> Registry:
    HKEY_LOCAL_MACHINE\
    SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLinkedConnections (REG_DWORD = 0x1)

Detailed version

    I usually create a new Group Policy Object (GPO) called SET Mapped Network Drives that will be dedicated to mapping the network drives and hold all related settings.

    The first setting is the most obvious: mapping the the drives.

    In the group policy editor, navigate to:

    User Configuration -> Preferences -> Windows Settings -> Drive Maps

    Microsoft has a pretty good explanation of this window and how to setup the maps so I won't duplicate their work here.

    The second setting is a little less obvious: Enable loopback processing mode.

    In the group policy editor, navigate to:

    Computer Configuration -> Policies -> Administrative Templates -> System -> Group Policy

    Set the User Group Policy loopback processing mode to Enabled. (I usually use Merge)

    And finally, the last setting: EnableLinkedConnections.

    It should be noted that this policy only affects Administrators. If the end user doesn't have administrator rights on a machine, the policy should take effect without this setting.

    In the group policy editor, navigate to:

    User Configuration -> Preferences -> Windows Settings -> Registry

    Add a new entry with the following values:
    Hive HKEY_LOCAL_MACHINE
    Key path SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
    Value name EnableLinkedConnections
    Value type REG_DWORD
    Value data 0x1 (1)


    And that should do it. Your drives should now map beautifully.

    Good luck!