Dim password As SecureString = New SecureString
Dim strBuffer As String = ""
Dim x As Integer
Dim strPassword = "password1"
For x = 0 To Len(strPassword)
password.AppendChar(Mid(strPassword, x + 1, 1))
Next
Dim pi As ProcessStartInfo = New ProcessStartInfo
With pi
.Arguments = " -v -i myprivatedsakey.ppk c:\util\remote-tools.exe root@12.34.56.789:/tmp/remote-tools.exe"
.FileName = "C:\util\pscp.exe"
.Verb = "open"
.UserName = "Administrator"
.Domain = "MYDOMAIN"
.Password = password
.WorkingDirectory = "C:\Util\"
.UseShellExecute = False
.RedirectStandardOutput = True
End With
Dim p As Process = New Process
With p
.StartInfo = pi
.Start()
End With
Do Until p.StandardOutput.EndOfStream
strBuffer = strBuffer & p.StandardOutput.ReadLine
Loop
p.WaitForExit()
Dim streamOut As StreamWriter = New StreamWriter("C:\temp\temp.log")
streamOut.Write(strBuffer)
streamOut.Close()
The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.
TRUSTED BY