Musings of a PC

Thoughts about Windows, TV and technology in general

How to hide shared folders under DFS Namespaces

There is a very well known “trick” to hide shares with Windows and that is to put a $ sign at the end of the share name. The problem is that this doesn’t work if you are using DFS Namespaces (DFSN).

The reason why it doesn’t work is because DFSN doesn’t advertise shares – it advertises folders and there is an underlying mechanism to transparently redirect computers trying to connect to those folders to the underpinning shares.

So if you have folders in your DFS Namespace that you want to hide just as if they were a share, how do you do it?

The answer lies in the fact that they are, indeed, folders. Go to the DFSN root server and open up the folder for your namespace. Right-click on the folder you want to hide and choose Properties. Then select the Hidden attribute and click OK. You will be asked if you want to apply the change to this folder only or to this folder, subfolders and files. You only need to apply the change to this folder only.

Be mindful of the fact, though, that this trick of hiding the folders only works so long as users aren’t showing hidden files and folders on their computers. If they are, these folders will still show up.

To make it even harder for users to find these “hidden” folders, it is necessary to set the System attribute on the folder. This then prevents the folders from being seen unless the user has unticked “Hide protected operating system files”.

Setting the system attribute on a folder requires the use of the attrib command with a very specific sequence of flags:

attrib –r +h +s <folder path>

The –r flag removes the read-only setting which is normally used by Windows on folders as an indicator that the folder might have customisation on it. Since we are talking about folders in the DFS Namespace, that isn’t going to apply here.

The +h flag applies the hidden setting. You need to do this as part of the same command as +s in order to make sure that the folder does actually get hidden and not just set as a system folder. You cannot apply the hidden flag after the folder has got the system flag set.

The +s flag applies the system setting.

3 responses to “How to hide shared folders under DFS Namespaces

  1. James Buist November 30, 2011 at 7:45 am

    I tried this. I’m running Win 2008 Std Edition. I can manually set the Hidden flag but when I try to use the attrib in the cmd i get the following message. I tried with all the switches to strat with then tried just removing the read only flag. This is the resutl

    C:\Users\adminstall>attrib -r C:\DFSRoots\admhk\admtest
    The target of the symbolic link C:\DFSRoots\admhk\admtest does not exist

    Anyone else tried this? It seems that the command fails as it doenst see the folder as a folder but as a symbolic link. I’m using a domain based namespace

  2. Pingback: How to hide shared folders under DFS Namespaces - Rui Qiu's Blog

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your 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

%d bloggers like this: