Re: cisco devices - WeOnlyDo Discussion board

Re: cisco devices (General questions)

by epoelke, Thursday, February 03, 2005, 23:01 (7029 days ago) @ wodSupport

thanks, but i got it worked out from another post. Here is the code thats works --

Module Module1
Dim WithEvents ssh As New WeOnlyDo.Client.SSH
Dim fs As New FileStream( c:config.txt , FileMode.Append, FileAccess.Write)
Dim sw As New StreamWriter(fs)
Dim s As String

Sub Main()
With ssh
.Hostname = 1.1.1.1
.Login = username
.Password = password
.Command = sh run & vbCrLf
.Protocol = ssh.SupportedProtocols.SSHAuto
.Encryption = ssh.EncryptionMethods.Auto
.Connect()
End With
Do

Loop Until ssh.State = WeOnlyDo.Client.SSH.States.Disconnected
End Sub

Private Sub ssh_DataReceivedEvent(ByVal Sender As Object, ByVal Args As WeOnlyDo.Client.SSH.DataReceivedArgs) Handles ssh.DataReceivedEvent
s = ssh.Receive
sw.Write(s)
End Sub

Private Sub ssh_DisconnectedEvent(ByVal Sender As Object, ByVal Args As System.EventArgs) Handles ssh.DisconnectedEvent
sw.Close()
fs.Close()
MsgBox(ssh.State.ToString, MsgBoxStyle.Information, disconnect event )
End Sub
End Module


Complete thread: