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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting weired when using wshshell.run with plink

Status
Not open for further replies.

bolobaboo

MIS
Aug 4, 2008
120
US
Hi
I have following code ...

Dim objFSO, a, s, WshShell, Windir, i, objWMIService, t
strComputer = "."
filespec="C:\anil\perl\server.txt" 'data file with IP addresses
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

s = objFSo_Opentextfile(filespec,1,true).ReadAll
a = Split(s,vbCrLf)

Set WshShell = CreateObject("WScript.Shell")
WinDir = WshShell.ExpandEnvironmentStrings("%WinDir%")

For i=0 to UBound(a)
Err.Clear
If Trim(a(i))<>"" Then
'Launch telnet session from the command line
WshShell.Run "c:\anil\plink.exe " & a(i)

If Err.Number <> 0 Then
wscript.quit
End if
'Wait until the application has loaded
WScript.Sleep 1500
Set ColProcesses = objWMIService.ExecQuery("Select * from Win32_Process",,48)
For Each Process in ColProcesses
If Process.Name = "plink " & a(i) Then
WshShell.AppActivate Process.Name
End If
Next
WshShell.SendKeys "dsmadm"
wscript.sleep 600
WshShell.SendKeys "{ENTER}"
wscript.sleep 600
WshShell.SendKeys "exiting4u{ENTER}"
wscript.sleep 600
wscript.sleep 600
WshShell.SendKeys "passwd"
wscript.sleep 600
WshShell.SendKeys "{ENTER}"
wscript.sleep 600
WshShell.SendKeys "welcome11"
wscript.sleep 600
WshShell.SendKeys "{ENTER}"
wscript.sleep 600
WshShell.SendKeys "welcome11"
wscript.sleep 600
WshShell.SendKeys "{ENTER}"
wscript.sleep 600
'WshShell.Sendkeys "exit"
wscript.sleep 600
WshShell.SendKeys "{ENTER}"
wscript.sleep 1000

End If
Next
wscript.quit


it starts plink session but it inputs weired character ..

login as: dsmadm
Using keyboard-interactive authentication.
Password:
Last login: Mon Jan 12 13:22:45 2009 from bwkn08b01089.f2
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
You have mail.
$ pa?ssd
ksh: pa?ssd: not found
$ wel?ome1?
ksh: wel?ome1?: not found
$ welcome11
ksh: welcome11: not found
$
$

Any idea why we getting weired character ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top