Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

If network drive exists

10,521 views
Skip to first unread message

shee...@yahoo.com

unread,
Jan 16, 2008, 12:32:20 PM1/16/08
to
Hello,

I am looking to write a little snippet of code that would look like
the following pseudocode. Does anyone know how this can be done?

if network drive exists (z: and y:) then
remove network drives
re-map them to new UNC path
else
map to UNC path
End if

Richard Mueller [MVP]

unread,
Jan 16, 2008, 12:56:43 PM1/16/08
to

<shee...@yahoo.com> wrote in message
news:cd680cc5-4cc5-4e42...@q39g2000hsf.googlegroups.com...

I use the DriveExists method of the FileSystemObject. In brief:
============
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objNetwork = CreateObject("Wscript.Network")

If (objFSO.DriveExists("H:") = True) Then
objNetwork.RemoveNetworkDrive "H:", True, True
End If
objNetwork.MapNetworkDrive "H:", "\\MyServer\MyShare"
==========
I do something similar in the MapDrive function in this example VBScript
logon script:

http://www.rlmueller.net/Logon3.htm

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--


nat...@webpals.cc

unread,
Jun 4, 2013, 11:43:38 AM6/4/13
to
Thanks
0 new messages