Collect network path from current mapping


I'm searching for a vb script that can collect the network path (\\servername\share) from an exsisting network mapping collected from WMI.

I have found an article that basicly does the tric here for all drivers:

I prefer to use the win32_mappedlogicaldisk and then the providername like mentioned in the article above (or if you have a better suggestion ;-)

But I only need to have the network path from the i:\ drive (so not all drives / instances.

Other info:
- the script will run locally as the current user

Please help.


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If you aren't married to using WMI to get it, it is stored in HKCU.


On the other hand, I slapped this together and tested it.  I do not know if a regular user would have access to it or not.  I know a lot of the WMI functions require admin access, but some of the query functions don't.

strComputer = "." 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 
Set colItems = objWMIService.ExecQuery( _
    "SELECT ProviderName,Name FROM Win32_MappedLogicalDisk where name like 'L:'",,48) 
For Each objItem in colItems 
    Wscript.Echo "-----------------------------------"
    Wscript.Echo "Win32_MappedLogicalDisk instance"
    Wscript.Echo "-----------------------------------"
    Wscript.Echo "Name: " & objItem.Name
    Wscript.Echo "ProviderName: " & objItem.ProviderName

Open in new window

The key is the Like part of the query, where you would specify the drive letter.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.