Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
NET USE - mapping a drive?
Message
 
To
24/11/2008 08:08:34
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01363755
Message ID:
01363790
Views:
13
>>I need first determine if a particular drive is already mapped and if it is not then need to connect to that windows share using NET USE. Not sure how this is done as I need to pass a userid and password in the connection. Would I use the RUN command?
>>
>>It is NOT as simple as using a UNC name for the current loggged in user since that user does not have permission to the share. I have to map a drive as an alternate user then will have access to the files on that required drive. Unfortunately, the sys admin will not let me do it the easy way so I am forced to do these tricks.
>>
>>Of course, I need to test the connection first since if I map the drive every time I will have too many connections to the same thing.
>>
>>Any got some example code on how to handle this ?
>
>
>
>if !directory('p:')
>   wshshell=CREATEOBJECT('wscript.shell')
>   wshnetwork=CREATEOBJECT('wscript.network')
>   wshnetwork.MapNetworkDrive('p:','\\myserver\mypath',.f.,'Username','Password')
>   wshnetwork=.null.
>   release wshnetwork
>Endif
Of course, you may need to keep both options open, if your network admin has disabled WS....
John Harvey
Shelbynet.com

"I'm addicted to placebos. I could quit, but it wouldn't matter." Stephen Wright
Previous
Reply
Map
View

Click here to load this message in the networking platform