404 Tech Support

DFS PowerShell cmdlet leaves a .DFSFolderLink entry

When populating your Distributed File System (DFS) namespace using PowerShell, you might notice a tiny quirk as I did. A .DFSFolderLink file gets left behind when using PowerShell. Using the GUI for DFS Management, this file gets deleted when a folder is created at that same level.

You can see the file in the image above. The other folder targets work fine (and have names that I’ve whited out) and that shortcut just links back to the current directory.

Using PowerShell, you create the DFS folder easily enough:

New-DfsnFolder -Path $path -TargetPath $targetpath

However, the .DFSFolderLink at the level is left behind. If you were to do the same thing in the GUI, the .DFSFolderLink is deleted. So, that’s the trick for resolution too. Create your structure with PowerShell but when you’re done open the GUI and create a new folder any place that there is a .DFSFolderLink and the file will be cleaned up. You can then delete your test folder and the .DFSFolderLink file does not return.

Another trick I found with the DFS PowerShell cmdlets was that you could not create a folder with just other folders in it as you could in the GUI. Every folder has to have a target path. If you need/want the extra level of folders for navigation but still want the sub-folders to be folder targets so the files can reside on different servers, you will have to use the GUI to create the new folders. This was observed with Server 2012 R2.