ATHENA_IT
asked on
How to make vbs loginscript check that mapped drive exists
Hello experts :)
I am facing a problem, makeing the correct vbs commands in my script.
I want to make the login script, which only purpose is to map some shared folders as drives.
I have made the script below already, but my problem is, that if ex. drive P: exists, an error turns up saying that it is already in use. I would like to know how I can make it just pass by, if the drive letter already is in use ?
Script:
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----
Option Explicit
Dim DriveLetter1, DriveLetter2, RemotePath1, RemotePath2
Dim objNetwork
Set objNetwork = CreateObject("WScript.Netw ork")
DriveLetter1 = "X:"
DriveLetter2 = "P:"
RemotePath1 = "\\server1\scan"
RemotePath2 = "\\server2\company"
objNetwork.MapNetworkDrive DriveLetter1, RemotePath1
objNetwork.MapNetworkDrive DriveLetter2, RemotePath2
Wscript.Quit
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----
Thank you in advance :)
I am facing a problem, makeing the correct vbs commands in my script.
I want to make the login script, which only purpose is to map some shared folders as drives.
I have made the script below already, but my problem is, that if ex. drive P: exists, an error turns up saying that it is already in use. I would like to know how I can make it just pass by, if the drive letter already is in use ?
Script:
--------------------------
Option Explicit
Dim DriveLetter1, DriveLetter2, RemotePath1, RemotePath2
Dim objNetwork
Set objNetwork = CreateObject("WScript.Netw
DriveLetter1 = "X:"
DriveLetter2 = "P:"
RemotePath1 = "\\server1\scan"
RemotePath2 = "\\server2\company"
objNetwork.MapNetworkDrive
objNetwork.MapNetworkDrive
Wscript.Quit
--------------------------
Thank you in advance :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.