Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > Re: How to use variables to map network drive

Reply
Thread Tools Display Modes

Re: How to use variables to map network drive

 
 
Al Dunbar
Guest
Posts: n/a

 
      05-14-2009

"T Lavedas" <> wrote in message
news:0ff91581-31c3-4078-85e9-...
On May 14, 2:45 pm, notsomuchscripting <notsomuchscripting.
3s6...@DoNotSpam.com> wrote:
> I want to ask the user to input the IP address of the server so that we
> can use this script at multiple sites. Also, I want the user to pick
> which open network drive they want to use.
>
> <code>
> dim answer
> IP=InputBox("What is the NBO server IP Address:")
>
> Drive=InputBox("What drive letter would you like to use for your
> install scripts?")
>
> Set objNetwork = CreateObject("WScript.Network")
>
> objNetwork.MapNetworkDrive Drive , Drive, "\\" IP "\data\zdm\apps"
> </code>
>
> --
> notsomuchscripting
> ------------------------------------------------------------------------
> notsomuchscripting's Profile:http://forums.techarena.in/members/98512.htm
> View this thread:http://forums.techarena.in/server-scripting/1180247.htm
>
> http://forums.techarena.in


Change ...

objNetwork.MapNetworkDrive Drive , Drive, "\\" IP "\data\zdm\apps"

to ...

objNetwork.MapNetworkDrive Drive, "\\" & IP & "\data\zdm\apps"

This presumes the user has entered the drive letter followed by a
colon. This may be problematic. Also, I presume there are a limited
number of IP addresses that can be used. Making the user enter the
entire IP address will probably be error prone. Therefore, I'd
suggest you hard code the possible IP selections and off the user a
menu from which to select. The simplest just uses the InputBox with a
longer prompt string, something like this ...

aIPAddresses = Array("A). 123.1.2.456", "B). 123.1.2.789", "C).
234.2.3.123")

IP=InputBox("Select the NBO server IP Address:" & vbCRLF & Join
(aIPAddresses, vbCRLF)

The more user friendly approach would be to create a dialog box using
IE and provide drop down selections, but that's beyound the scope of
what you asked.

BTW, the WSH documentation might be helpful for things like this ...

WSH 5.6 documentation download (URL all one line)
http://www.microsoft.com/downloads/d...displaylang=en

Tom Lavedas
***********

===================

Why IP address rather than server name?

/Al


 
Reply With Quote
 
 
 
Reply

Thread Tools
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems accessing network drive folder with UNC & mapped drive Charles MacLean Windows Small Business Server 2 06-10-2009 11:03 AM
trouble moving files from local drive to network drive dwsdad Windows Vista Networking 0 02-25-2008 11:32 AM
SP2 - Drive needs to be Shared on Vista machine to be made into Network Drive ?? Synapse Syndrome Windows Server 0 03-19-2007 02:29 AM
How to make the Windows think a network drive is a local drive.... Martin Westphal Server Networking 0 08-11-2005 07:30 AM
Change drive path if network drive exist! tjcooper Scripting 0 06-24-2004 05:44 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59