SSH Execute Task

169 views
Skip to first unread message

bpa...@tricorbraun.com

unread,
Oct 24, 2007, 2:43:04 PM10/24/07
to CozyRoc
Is there a way to use this task in a script task. An Example wood be
nice.

Ivan Peev

unread,
Oct 24, 2007, 3:06:32 PM10/24/07
to CozyRoc
Sure you can do it. When you open your script task editor please add
reference to CozyRoc.SSISPlus library. Please check the following
sample:

----------------------------------------------------------------------------------------------------------------------------------------------
' Microsoft SQL Server Integration Services Script Task
' Write scripts using Microsoft Visual Basic
' The ScriptMain class is the entry point of the Script Task.

Imports System
Imports Microsoft.SqlServer.Dts.Runtime
Imports CozyRoc.SqlServer.SSIS


Public Class ScriptMain
Public Sub Main()
Dim oSsh As SshExecTask

oSsh = New SshExecTask()
oSsh.ExecConnection = "SSH"
oSsh.CommandType = SshExecTask.CommandTypes.DirectInput
oSsh.Command = "ls"
oSsh.Output = "Koko"
Call oSsh.Execute(Dts.Connections, Dts.VariableDispenser,
Dts.Events, Dts.Logging, Dts.Transaction)

Dts.TaskResult = Dts.Results.Success
End Sub
End Class
----------------------------------------------------------------------------------------------------------------------------------------------

Where
- ExecConnection variable contains the name of the SSH Connection
Manager.
- CommandType variable specifies where your command comes from. In the
sample it is directly specified in the "Command" variable.
- Output variable contains name of variable, which holds the result of
the executed command.

Regards,
Ivan

bpa...@tricorbraun.com

unread,
Oct 24, 2007, 3:11:02 PM10/24/07
to CozyRoc
Thanks you just what I needed. One last question, Instead of telling
to use the COnnection Manager, can you set the properties in the
script. Such and server name, user name, password.

Ivan Peev

unread,
Oct 24, 2007, 3:25:01 PM10/24/07
to CozyRoc
Yes, but you still have to have SSH connection manager and setup the
"ConnectionString" variable before executing the SSH command:

----------------------------------------------------------------------------------------------------------------------------------------------
Dim connManager As ConnectionManager

connManager = Dts.Connections("SSH")
connManager.ConnectionString =
"ServerHost=;ServerPort=22;ServerUser=;ServerPassword=;ServerKeyFile=;ServerTimeout=30;ProxyType=None;ProxyHost=;ProxyPort=80;ProxyUser=;ProxyPassword="
----------------------------------------------------------------------------------------------------------------------------------------------

Regards,
Ivan

Reply all
Reply to author
Forward
0 new messages