Is it possible to give a network drive mapping (as created with the WNetAddConnection functions or “Map network drive…” GUI) a label other than the default “<Target Name> (<Target Path>) (<Drive Letter>:)” one?
I tried giving SetVolumeLabel a go but this always fails, and I see nothing in the WNet API’s to specficy the display label.
This isn’t a 100% solution but it’s more of an answer than a comment…
If you rename a mapped network drive the the GUI (by right clicking on it and going to ‘Rename’) it adds a value to the registry. Reading round on various sites (notably this one) it looks like Windows may sporadically delete this value by itself, so this may not be a permanent solution…
I have just manually done it through regedit and it worked in the GUI, so I see no reason why it shouldn’t work programmatically as well
Add a string value called
_LabelFromRegwith a value of whatever you want the label to be to the registry keyThis key should already exist if you have already created the share.
Apparently (see the link above) you then need to make that key read-only to prevent the OS from changing it back at will – I don’t know how you would do that programmatically but i’m sure it can be done.
I know there are huge gaps in this answer, but maybe it’s a poke in the right direction?