質問編集履歴

1

試行コードを追記致しました。

2019/10/01 11:10

投稿

ctk
ctk

スコア31

test CHANGED
File without changes
test CHANGED
@@ -23,3 +23,83 @@
23
23
 
24
24
 
25
25
  以上です、よろしくお願い致します。
26
+
27
+
28
+
29
+
30
+
31
+ Dim sIPAddress As String
32
+
33
+ Dim sUser As String
34
+
35
+ Dim sPassword As String
36
+
37
+ Dim sCommand As String
38
+
39
+
40
+
41
+ Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
42
+
43
+
44
+
45
+ sIPAddress = IPadressText.Text
46
+
47
+ sUser = UserText.Text
48
+
49
+ sPassword = PasswordText.Text
50
+
51
+ sCommand = CommandText.Text
52
+
53
+
54
+
55
+ Dim connInfo As New Renci.SshNet.PasswordConnectionInfo(sIPAddress,
56
+
57
+ sUser,
58
+
59
+ sPassword)
60
+
61
+
62
+
63
+ Using client As New Renci.SshNet.SshClient(connInfo)
64
+
65
+
66
+
67
+ client.Connect()
68
+
69
+
70
+
71
+ Dim cmd As Renci.SshNet.SshCommand
72
+
73
+ Dim result As String
74
+
75
+ Dim result2 As String
76
+
77
+
78
+
79
+ cmd = client.CreateCommand(sCommand)
80
+
81
+ cmd.CommandTimeout = TimeSpan.FromSeconds(10)
82
+
83
+ result = cmd.Execute
84
+
85
+ result2 = cmd.Error
86
+
87
+ TextBox1.Text = cmd.ExitStatus
88
+
89
+
90
+
91
+ If Not String.IsNullOrEmpty(result2) Then
92
+
93
+ TextBox1.Text = result2
94
+
95
+ End If
96
+
97
+
98
+
99
+ TextBox1.Text = result
100
+
101
+ client.Disconnect()
102
+
103
+ End Using
104
+
105
+ End Sub