Hello Experts,

I am using below vb script to telnet to a switch and run some commands. But I dont know how to redirect the output of the commands to a text file. I need the output of the commands "show" and "config" send to a text file. Any help is greatly appriciated.

Code:
Dim objShell
Dim objNetwork

Set objNetwork=CreateObject("WScript.Network")

strTitle="Telnet Demo"
strDefaultServer="Server01"
strDefaultUser=objNetwork.UserDomain & "\" & objNetwork.UserName
strDefaultPassword="P@ssw0rd"

strComputer=InputBox("What server or device do you want to connect to?",_
strTitle,strDefaultServer)
If Len(strComputer)=0 Then WScript.quit

strUsername=InputBox("What credential do you want to use",strTitle,_
strDefaultUser)
If Len (strUsername)=0 Then WScript.Quit

strPassword=InputBox("What password do you want to use?",strTitle,_
strDefaultPassword)
If Len (strPassword)=0 Then WScript.Quit

Set objShell=CreateObject("wscript.shell")
'Start Telnet
objShell.Run "Telnet " & strComputer
'Give app a chance to get started
WScript.Sleep 5000
objShell.AppActivate "Telnet " & strComputer

'Send login credentials
objShell.SendKeys strUsername & "~"
WScript.Sleep 2000
objShell.SendKeys strPassword & "~"
WScript.Sleep 2000

'Send commands
objShell.SendKeys "show"
WScript.Sleep 200
objShell.SendKeys "~"
WScript.Sleep 200
objShell.SendKeys "config"
WScript.Sleep 200
objShell.SendKeys "~"

'Close session
'make sure we get window again
objShell.AppActivate "Telnet " & strComputer
objShell.SendKeys "logout"
WScript.Sleep 200
objShell.SendKeys "~"

Thanks in advance