Hi Guys,
I am not proficient in VB although but can hack my away around from time to time.
At the moment, I am trying to write a very basic app that will allow a user to select a shared drive from a list and then click a button to map it. I have got this working quite nicely but despite searching I cannot find an example of how to rename the mapped drive so it has a friendly name e.g. instead of "X: \\server\share" it would show as "X: Main File Server".
I have found the below code which is VBS but I am not skilled enough to get this working in VB.NET (VS2019). Can anyone please help point me in the right direction?
I am not proficient in VB although but can hack my away around from time to time.
At the moment, I am trying to write a very basic app that will allow a user to select a shared drive from a list and then click a button to map it. I have got this working quite nicely but despite searching I cannot find an example of how to rename the mapped drive so it has a friendly name e.g. instead of "X: \\server\share" it would show as "X: Main File Server".
I have found the below code which is VBS but I am not skilled enough to get this working in VB.NET (VS2019). Can anyone please help point me in the right direction?
VB.NET:
Dim drv, label
Dim shellApp
Dim objNet
Set objNet = CreateObject("Wscript.Network")
objNet.MapNetworkDrive "q:", "\\st106\data"
drv = "q:\" ' drive letter of mapped driver
label = "testtest" ' new label of mapped drive
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> THE BELOW IS WHAT I THINK I NEED IN MY VB.NET PROJECT BUT I DON'T KNOW HOW TO WRITE IT >>>>
Set shellApp = CreateObject("Shell.Application")
' set the drives label
shellApp.NameSpace(drv).Self.Name = label
WSCript.Quit
Last edited: