Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBS Script to Install Telnet

Status
Not open for further replies.

rickism21

IS-IT--Management
Oct 10, 2013
17
US
Hello All,

I am working on installing/enabling telnet client on windows machine for our IT network. I found this command
pkgmgr /iu:"TelnetClient" that installs telnet and it works. I decided to place the command in a batch file (run.bat) and the call the batch file with a vb script (install.vbs) They all work but I get a pop us window stating UNC not supported since the batch file reside on our domain controller.

Question

Can I issue the same command (pkgmgr /iu:"TelnetClient") that's in the batch file in a vb script to install/enable the telnet client on windows machines???

Thanks,
 
The first question that should be answered is why are you messing with a CMD file and executing it from a vbscript? PKGMGR is a command line utility that can be directly invoked using the wshShell.Run command directly within your script. Using the parameters of the wshShell.run command you can also hide the pop-up window and control whether you wish your script to wait for PKGMGR to finish before continuing or just execute PKGMGR as a separate thread and have the script continue. Take a look at for examples of how you might use the command to your advantage. My advice is never put something into a CMD file that you can code within the a vbscript itself. Makes everything less complicated and cleaner.
 
Thanks for your inputs. I will write a script now based on the recommendations. I think this is exactly what I am looking for.
 

I am having some issues with the script. I am new to this. Can you take a look and tell me when I am going wrong. Thanks

Script 1

Set WshShell = WScript.CreateObject("WScript.Shell")
Return = WshShell.Run("pkgmgr /iu:("TelnetClient")" & WScript.InstallTelnet, 1, true)

Script 2

Dim oShell
Set oShell = WScript.CreateObject ("WScript.Shell")
oShell.run pkgmgr /iu:("TelnetClient")
Set oShell = Nothing
 
You must be getting an error. What is it? Will you please post the entire script?
At first glance, take away the middle parenthesis and you need to escape your quotes so the cmd is properly interpreted. Also, what is "WScript.InstallTelnet" ?

Code:
Set WshShell = WScript.CreateObject("WScript.Shell")
Return = WshShell.Run("pkgmgr /iu:[COLOR=#FF0000][b]"[/b][/color]"TelnetClient[COLOR=#FF0000][b]"[/b][/color]"" [s] & WScript.InstallTelnet[/s], 1, true)

-Geates

 
The error message is as follows.

Script \\domain.xxx.com\netlogon\Telnetnow.vbs
line 3
char 1
Error Object doesn't support this property or method: 'Wscript.TelnetNow'
Code: 800A01B6

Thank you Sir
 
Geates,

You are a genius. I removed that line and it worked with no pop ups.

Thanks,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top