Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Novell Map Network Drive Via Code
Message
From
01/07/2003 13:54:02
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00805445
Message ID:
00805757
Views:
39
Hi Kevin,

First, thanks for yoyur kind words.
Keep in mind that RemoveNetoworkDrive will generate an error if letter isn't mapped. You can use EnumNetworkDrives method to loop through existing network drives.
lcDriveLetter = "V:"
oDrives = oNet.EnumNetworkDrives()
FOR i=oDrives.Count-1 TO 0 STEP -2
*? oDrives.Item(i-1), "-", oDrives.Item(i)
IF oDrives.Item(i-1) = lcDriveLetter
oNet.RemoveNetoworkDrive(lcDriveLetter)
EXIT
ENDIF
ENDFOR
>
> This is exactly what I needed. I have seen you on here helping a lot of people. I hope everyone really appreciates what you do for them, I know I do. One thing I would like to note in case someone else notices this and wants to know how to do this as well, is that it seems it will error if you try to map a drive to a different location if it is already mapped elsewhere. When using the Wscript.Network class, my autofill showed me there was a oNet.RemoveNetoworkDrive("DRIVELETTER") as well, so I guess it would be advisible to do this first to make sure the drive is clear before trying to map it elsewhere. Also, I guess the reason I selected Client/Server as the subject is because I will be initiating the code from client computers to connect to a network drive on the server.
>
>Thanks Again


--------------------------------------------------------------------------------

--sb-- MVP VFP

A computer program will always do what you tell it to do, but rarely what you want to do.

sergeyb AT isgcom DOT com

Thanks a lot, I am sure I would have been asking that question when I ran into that when I actually started coding with it. You can tell you are a programmer, always thinking ahead and answering the questions before they come up. Thanks again.

Oh something else I was thinking about on the lines of coding for the network, I noticed that you can also grab the computer name assigned to a workstation using this class as well. Is there any way to do the reverse and force a change on the name of a computer? I would like to name users computers to match their username value in a password table I use in my program. Following that I will be able to grab their IP addresses for the machines and store them into a table on login so I can build a monitoring system in my program to display them.

Ohhhh and I must follow this up with a dumb question... How do you change the backcolor in these replies through the thread to show what the other person typed from what you reply to them?

Thanks Again
``` Appreciate a normal day, it is always better than a bad one ```

Kev
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform