Invoke a script in UNIX using Excel Macro

Hi,

I am using Send Keys to connect to UNIX server and invoke a script .

Is there an alternate way to connect to UNIX server using Excel macro and invoke a UNIX Shell script?

Anu

Depending on your version, I believe there's either a shell() or an exec() call available to allow you to use a local SSH client like putty.

You could probably accomplish it either as a direct call to a specific ssh connection, or wrap it up in a local batch file. Word of caution though, the more external components you fold into the process, the more difficult it would become to support.

I have used the following code to connect to UNIX Server.
The connection is successful and the wsTCP.State is 7 .

I need to sudo as a diff user , enter password and invoke a script . Can anyone help?

Option Explicit
Dim sPage As String
Dim wsTCP As OSWINSCK.Winsock
Dim shpGo As OSWINSCK.Winsock

Private Sub Button1_Click()

On Error GoTo ErrHandler
Dim sServer As String
Dim nPort As Long
Dim sBuffer As String
Dim Password As String

Set wsTCP = CreateObject("OSWINSCK.Winsock")
Set shpGo = CreateObject("OSWINSCK.Winsock")
sServer = "servername"
nPort = 22

wsTCP.Protocol = sckTCPProtocol
'wsTCP.Connect sServer, nPort
wsTCP.RemoteHost = "servername"
wsTCP.RemotePort = 22
wsTCP.Connect

Password = InputBox("Type your password here.", "Password Required")
If Password = "" Then
MsgBox "You didn't enter a correct password."
End
End If

MsgBox "Connection Successful"
MsgBox "State: " & wsTCP.State
MsgBox "Status: " & wsTCP.Status
MsgBox "BytesReceived: " & wsTCP.BytesReceived
MsgBox wsTCP.LocalHostName
wsTCP.GetData sBuffer
MsgBox "GetData: " & sBuffer
wsTCP.SendData "sudo as a diff user"
wsTCP.SendData Password

/execute a script/

Debug.Print "connect to unix system"

Exit Sub
ErrHandler:
MsgBox "Error " & Err.Number & ": " & Err.Description
End Sub