Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 10th, 2003, 11:20 AM
Authorized User
 
Join Date: Jun 2003
Location: St-Laurent, Quebec, Canada.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Mapping and Connecting to other machine

Hello All,

I have an application that runs overnight and need to connect to all servers and do someting.

I have a batch file which consist of the following examples:

rem *** ST01A02 ***
map root t:=\\st01a02\sys
t:
purge *.* /a

map root t:=\\st01a02\data02a
t:
purge *.* /a

map root t:=\\st01a02\data02b
t:
purge *.* /a

This batch file map to the machine and give it a letter t.

Is there a way to map and connect to servers in VB, do someting (run application) and then disconnect from that machine and repeat this process as needed?

Thank you



A.Delcy
Web Administrator
Canada
__________________
A.Delcy
Developer
Canada
Reply With Quote
  #2 (permalink)  
Old June 11th, 2003, 03:39 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Take a look at the Windows Scripting Host stuff, specifically the WshNetwork object which has methods MapNetworkDrive and RemoveNetworkDrive.

BTW if you just want to work with files on remote machines you can use the FileSystemObject which accepts UNC paths, so no need to map a drive at all.

Also, the Remote Scripting capabilities may be of interest to you - depends exactly what you want to do.

hth
Phil
Reply With Quote
  #3 (permalink)  
Old June 11th, 2003, 08:26 AM
Authorized User
 
Join Date: Jun 2003
Location: St-Laurent, Quebec, Canada.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you Phil, this is exactly what I found out yesterday from the MSDN online.

I tried it and it worked just like I was hoping.

Again, thank you all



A.Delcy
Web Administrator
Canada
Reply With Quote
  #4 (permalink)  
Old June 11th, 2003, 10:33 AM
Authorized User
 
Join Date: Jun 2003
Location: St-Laurent, Quebec, Canada.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello all,

I have been able to map the drive from VB using the wshom reference. See code below:

----Start code
Dim objMap As WshNetwork

Set objMap = New WshNetwork
Call objMap.MapNetworkDrive(pstrMapDriveLetter, pstrPathToMap, True)
-----End Code

Yesterday, everything was working as expected but today it failed to map that same drive.
See error:

Automation error
The specified device name is invalid.

my Drive Letter
"T:"

Path that I am mapping to
"\\Stn006d\Data06a"

Does anybody knows what is happening here?

Thank you

A.Delcy
Web Administrator
Canada
Reply With Quote
  #5 (permalink)  
Old June 12th, 2003, 04:50 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

sounds like your network connection is playing up. Can you browse to \\Stn006d\Data06a using Explorer?
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Retore Db from a remote machine to a local machine srkvellanki BOOK: Beginning SQL 0 October 3rd, 2008 05:17 PM
Copy from one machine to another machine somnath.kartic SQL Server 2000 2 January 12th, 2006 03:13 PM
Character Mapping muki XSLT 2 November 11th, 2005 03:11 AM
O/R mapping s_sana General .NET 0 April 12th, 2005 06:34 AM
mapping a database. kyootepuffy Classic ASP Databases 11 August 22nd, 2003 03:32 AM



All times are GMT -4. The time now is 02:41 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.