PDA

View Full Version : Mapping network drives and printers


twedlake
03-07-2001, 04:28 AM
I have created a script that maps network drives using the mapnetworkdrive method at logon. It works great with one exception. If the drive is already connected it presents an error saying it's already connected. How can I tell WSH something like "if exist don't map" or "if exist then delete drivemapping" to keep from seeing the error message. Also I wanted a dialog box to popup on logon saying a certain message. I got that to work using the WshShell.Popup method. Only thing is, I don't want any buttons on the dialog. I can't seem to get rid of the ok button. The diloag goes away on it's own after about 5 secs but it's annoying! :)

Any help would be appreciated.
Thanks
Todd

Karin
03-07-2001, 09:37 AM
Hi Todd,

you can use the Err.number if a drive is already connected:

if Err.Number = -2147024811 then
'a message for the user
else
'connect the drive
end if

I think the OK Button is default and allways displyed.

best
Karin

prasad
07-10-2001, 02:17 PM
Hi
You can use EnumNetworkDrives method to enumerate all the mapped drives.This collection contains the drive letter and path to share folder for each mapped drive. So if the the folder you are going to map exist in the collection, you will not map the drive.
Let me know whether it has worked or not?
-Prasad

twedlake
09-20-2001, 02:17 PM
Worked great. Thanks a million!

Todd