Jump to content

Hey,

I'm just going to explain how I got the network folders to show up with unique icons on the computers at the office I work at.

If you feel like I'm over explaining it, it's just that I prefer to be detailed and share this with others, so I'd like to only write it once.

The network shares are on a Synology NAS using Linux but with CIFS/Samba (Windows Network Share Protocol). So I know this works for sure even if Linux is the base OS as long as it's using CIFS/Samba (because those support Windows file permissions).

Basically, if you search for "hidden files" in the windows search, you'll get an option that if you click it, will open the menu to show hidden files and folders.

If you uncheck "hide system files", a "desktop.ini" will appear on your desktop. If you place this in a folder with instructions to customize the folder, and the server is sharing it via Windows network protocol (CIFS) to a Windows machine, the client machine that's accessing the share will see the share with the unique icon.

I didn't have to configure the client machines at all, once I was done with this. It was all server and permission based.

The desktop.ini's required settings are explained here:

[.ShellClassInfo] *<defines the class of the .ini file.*
IconFile=icon.ico *<is the file to be used as custom icon*
IconIndex=0 *<is the index of the file to be used as custom icon (in case you are referencing a .dll that has multiple icons but it's required so 0 is the one you want)*
InfoTip=401(k) test. *<is a custom tool tip for the file, but I couldn't get this to work on the server. It might be because it's a Linux server, but IDK. YMMV*
 
That's it. The IconFile can be a path (i.e. C:\wtv\icon.ico), variable (i.e. %appdata%\wtv\icon.ico), or just the file itself if it's in the same directory as the .ini.

The file to be used as the icon is preferred to be .ico but other image types work I believe. Resolution should be 64x64 as that's optimal. I used GIMP to create those and kept them simple for obvious reasons.

Now, actually getting this to work is a bit of a chore in that it requires usage of the command prompt as I don't know how to give a file the system file flag in Windows without it. 

Essentially what this is doing is it's tricking Windows into thinking the Network Share is local when it's not by putting the desktop.ini file in it and making it a system file. This makes Windows recognize it's unique icon and use it. 

Note: After it's set up, if you change the file or disable it to make it go back to normal, Windows will have cached the icon image file and won't update without a restart or a long time of waiting AFAIK.

Anyway, the way you do is in these steps:
  1. Make share with CIFS/Samba protocol.
  2. Add share to windows computer.
  3. Create unique icon and put it in the folder's directory (i.e. if the network share is F:, then F:\<folder you wish to customize>\icon.ico is where it should be, same with desktop.ini).
  4. Copy over the desktop.ini to the base directory of the share (i.e. F:\desktop.ini).
  5. Press Super/Windows Key +X and click Command Prompt (not ADMIN, as you need the user who has access to the share, which the Admin does not unless you gave him permission or you gave everyone permission).
  6. Change drive to the share. In Windows Command Prompt, changing directory is cd <path>, but changing drive is just typing the drive's letter then colon and hitting enter. i.e. F: then hit enter and it will switch to F:. Then do "cd <path to folder you wish to customize>" and hit enter.
  7. This is the part that makes this whole thing work. The issue I struggled with at first. 

    Type (without "s): "attrib +s +h desktop.ini" and hit enter.

    That will make the desktop.ini file hidden (+h) and a system file (+s). You can do the same to the icon image file, but it's not necessary at all. I do recommend making it hidden just so users can't accidentally delete it.

And that's it. It should work fine. Note that you can make other resolution images up to 256x256 or down to 16x16, but Windows has built-in scaling to deal with that. Not really a big deal imo.

This should make anyone who connects to this network share get the unique icon as a folder icon 100% of the time so long as the requirements are met (to reiterate):
 
  1. Make icon image file .ico type and one of these resolutions:
    16x16, 32x32, 48x48, 64x64, 128x128, 256x256.
  2. Make a desktop.ini file with the correct lead in (.ShellClassInfo) and specifying the icon image file as the folder icon (IconFile=Folder.ico), and index set correctly (IconIndex=0).
  3. Share the network share from a server that supports CIF/Samba and to a Windows machine (not entirely sure if it would work on Linux, but from what I've seen, it doesn't because desktop.ini is Windows specific even if using CIFS/Samba).
  4. Make sure the desktop.ini file is a system file (hidden is just a precaution to keep users form tinkering with it) via "attrib +s desktop.ini".

Any questions, just ask.

† Christian Member †

For my pertinent links to guides, reviews, and anything similar, go here, and look under the spoiler labeled such. A brief history of Unix and it's relation to OS X by Builder.

 

 

Link to post
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×