how to connect to UNIX using vbscript
Hi I am very much new to VB.I have some shell scripts which captures some logs from datastage.Now i have to wite a vbscript which will take login credentials as user input and then will connect to unix server and run the shell script.I have found that i can do this by winsock.can anyone help me regarding this.please post the code.as i dont have idea about vb script .please help.
Re: how to connect to UNIX using vbscript
Welcome to VBForums :wave:
Thread moved from 'VB6 and Earlier' forum to 'VBScript' forum
Re: how to connect to UNIX using vbscript
i have writen something but not sure if it works.Vb is not installed in my mc.also from google i found that to use winsock to conncet to unix mc ,there must be some script/progarmme in the unix server so that it could understand what i am sending through winsock...totally messed up plz help
Code:
<html>
<head>
<title>Datastage Job Details</title>
<SCRIPT LANGUAGE="VBScript">
Option Explicit
Private Sub Submit_OnClick()
Dim TheForm,U_name,Pwd,U_mc_name,Port
Set TheForm = Document.cnct_to_unix
Set U_name = TheForm.txt1.value
Set Pwd = TheForm.txt2.value
Set U_mc_name = TheForm.txt3.value
Set Port = TheForm.txt4.value
Winsock1.Open
Winsock.RemoteHost = U_mc_name
Winsock.RemotePort = Port
Winsock1.Connect
Winsock1.SendData U_name
Winsock1.SendData Pwd
If winsock1.state = sckconnected then
Msgbox "connect to unix server system"
End If
Winsock1.SendData "cat testing"
Winsock1.Close
Debug.Print "Connection close."
End Sub
</SCRIPT>
</head>
<body>
<h1 style="color:blue">Please provide Login Credentials </h1>
<form name="cnct_to_unix">
<table border="0" width="500" cellpadding="0" cellspacing="10">
<tr>
<td width="25%">Username:</td>
<td width="25%"><input type="text" name="txt1" size="15"></td>
</tr>
<tr>
<td width="25%">Password:</td>
<td width="25%"><input type="password" name="txt2" size="15"></td>
</tr>
<tr>
<td width="25%">Unix M/C Name:</td>
<td width="25%"><input type="text" name="txt3" size="15"></td>
</tr>
<tr>
<td width="25%">Port:</td>
<td width="25%"><input type="text" name="txt4" size="15"></td>
</tr>
<script type="text/vbscript">
document.write(Date& "<br />")
document.write(Time)
</script>
<tr>
<td width="25%"> </td>
<td width="75%" colspan="3"><input type="SUBMIT" value="SUBMIT"></td>
</tr>
</table>
</form>
</body>
</html>
Re: how to connect to UNIX using vbscript
You're attempting to execute the winsock method in client script. Does your client machine have the necessary components installed?
Re: how to connect to UNIX using vbscript
What are the necessary component..Vb is not installed
Re: how to connect to UNIX using vbscript
Quote:
Originally Posted by
arijitghosh21
What are the necessary component..Vb is not installed
Read this for more information.
Re: how to connect to UNIX using vbscript
Thanks for ur rply
but still not able to connect ..If u please clear something ...like
1. to use winsock do we have to create winsock object.
2. to connect to unix using winsock is it necessary to have some scripts running in the Unix server
3. If we can use variable with winsock ,Like i have used in the above code.
Re: how to connect to UNIX using vbscript
What is the error that you are getting?