Detect and administer long filenames in your environment

The maximum length of a path name is 256 characters, which includes all parent directories and the filename. 255-character mixed-case long filename is possible only for files, or folders with no sub-folders, at the root folder of any drive.

That does not mean that users will stop or known this information;

It is your duty as admin that you are able to or have it under control.

In order to do so you could run this example script to get a list and amend these files or advise the users. This would be easily accomplished as it for example you were to send an email automatically to the owner of that file pulling the email address from AD via automated script , Advising to rename the file

$path= C:\Example
Get-ChildItem "$path" -Recurse -Force -ErrorAction SilentlyContinue | 
Where-Object {$_.FullName.Length -gt 260}

Another option is to allow it ( not recommended from in opinion )

How to enable longer filenaming ( Windows 10)

In Windows 10 long file name support can be enabled which allows file names up to 32,767 characters.

  1. Start the registry editor (regedit.exe)
  2. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
  3. Double click LongPathsEnabled
  4. Set to 1 and click OK
  5. Reboot

This can also be enabled via Group Policy via Computer Configuration > Administrative Templates > System > Filesystem > Enable NTFS long paths.

Enable NTFS long paths (Windows Server 2016) (Group Policy ...

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.