First you get all mappings with wshNetwork.EnumNetworkDrives then check them
Trick is index 0,2,4 etc are driveletters
Index 1,3,5 etc are the mappings
You could do something like this:
Option Explicit
Dim wshNetwork
Dim maps
Dim i
Set wshNetwork = CreateObject("Wscript.network")
Set maps=wshNetwork.EnumNetworkDrives
for i=0 to maps.Length-2 step 2
Wscript.echo maps.item(i) & vbTAB & maps.item(i+1)
Next
Hth
Reÿé
From: Steve Kelsay [mailto:[email protected]]
Sent: Friday, March 20, 2009 5:19 PM
To: NT System Admin Issues
Subject: Scrip Help please?
I am looking for help writing a VBScript to
1. Detect whether a specified mapped drive exists
2. If so, retrieve the target mapping (if the X: drive is not mapped to
\\server\share <file:///\\server\share> , then map it )
I have Googled and found lots of stuff, but nothing that does this. I can
retrieve the drive letter and see if it exists, but where it is mapped to is
eluding me.
It has to be simple.
***
The information in this e-mail is confidential and intended solely for the
individual or entity to whom it is addressed. If you have received this e-mail
in error please notify the sender by return e-mail delete this e-mail and
refrain from any disclosure or action based on the information.
***
~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~