NMHGADM
asked on
How do I connect to mapped drive asking for login / password in VB
Have a mapped drive on a windows 2003 server. It is a secure drive requiring a login and password to access (mapped to an AS400 and loses connectivity after the weekend IPL).
I have some VB code that needs to get files from this mapped folder. I can manually double-click on folder and enter login and password. The drive will then be available until the next IPL.
Can someone show the vb code to connect the drive after a Try/Catch fails using a
Directory.SetCurrentDirect ory(Folder X)?
I have some VB code that needs to get files from this mapped folder. I can manually double-click on folder and enter login and password. The drive will then be available until the next IPL.
Can someone show the vb code to connect the drive after a Try/Catch fails using a
Directory.SetCurrentDirect
ASKER
I am relying on the existance of the mapped drive.
The problem is that you can not be sure that the mapped drive is there, or that the mapped drive is mapped with the correct credentials.
If you catch an error because the mapped drive is not present, the option is to map the drive with the credentials with which the VB application is running.
If you catch an error because the mapped drive is not present, the option is to map the drive with the credentials with which the VB application is running.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
BTW, VBScript doesn't support a Try Catch method....that's .NET....
ASKER
Thanks Rob - since I am very very new at VB.net I will have someone review with me the link you provided and let you know.
ASKER
Thax Rob were were able to make this work and tested fine
Great. Thanks for the grade.
Rob.
Rob.
Which method are you using to map/access the drive? Net use or are you relying on the existance of the mapped drive when you run the script?