|
| |||||||||
| Tags: map, variables |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| How to use variables to map network drive
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> |
|
#2
| |||
| |||
| Re: How to use variables to map network drive
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 *********** |
|
#3
| |||
| |||
| Re: How to use variables to map network drive "T Lavedas" <tglbatch@cox.net> wrote in message news:0ff91581-31c3-4078-85e9-14146b70c120@g20g2000vba.googlegroups.com... 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 |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "How to use variables to map network drive" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Not able to access Network Drive or Network Files | dino88 | Networking & Security | 4 | 18-01-2011 10:01 AM |
| Problems accessing network drive folder with UNC & mapped drive | Charles MacLean | Small Business Server | 2 | 10-06-2009 05:33 PM |
| Map a Network Drive on Vista Premium on Network Attached Storage ( | OverDose | Windows Vista Network | 1 | 19-01-2008 07:12 AM |
| Disconnected Network Drive - Zombie Drive? | jgoerich | Windows Server Help | 3 | 03-01-2008 09:21 PM |
| Network Mapped Drive : Lost Network Connection | Ian Robert | Windows Vista Network | 14 | 24-08-2007 04:28 PM |