|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to use variables to map network driveI 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.htmhttp://forums.techarena.in On May 14, 2:45 pm, notsomuchscripting <notsomuchscripting.
3s6...@DoNotSpam.com> wrote: Show quoteHide quote > I want to ask the user to input the IP address of the server so that we Change ...> 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 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/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en Tom Lavedas *********** "T Lavedas" <tglba***@cox.net> wrote in message On May 14, 2:45 pm, notsomuchscripting <notsomuchscripting.news:0ff91581-31c3-4078-85e9-14146b70c120@g20g2000vba.googlegroups.com... 3s6...@DoNotSpam.com> wrote: Show quoteHide quote > I want to ask the user to input the IP address of the server so that we Change ...> 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 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/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en Tom Lavedas *********** =================== Why IP address rather than server name? /Al
Stop windows service copy data and then start service
How to pass parameter from a file (txt/dll) to vbs code Set Local Computer Description Use VBScript to Set Local Computer Description batch file to split multiple text files in half. Inventory script question How do implement this wildcard? Logon script help Get computer name as variable to use in vbs script. how do I disjoin a machine to workgroup name |
|||||||||||||||||||||||