|
-
Apr 12th, 2011, 03:15 AM
#1
Thread Starter
New Member
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.
-
Apr 12th, 2011, 05:10 AM
#2
Re: how to connect to UNIX using vbscript
Welcome to VBForums 
Thread moved from 'VB6 and Earlier' forum to 'VBScript' forum
-
Apr 13th, 2011, 06:04 AM
#3
Thread Starter
New Member
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>
Last edited by si_the_geek; Apr 13th, 2011 at 06:11 AM.
Reason: added Code tags
-
Apr 13th, 2011, 08:54 AM
#4
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?
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
-
Apr 13th, 2011, 09:29 AM
#5
Thread Starter
New Member
Re: how to connect to UNIX using vbscript
What are the necessary component..Vb is not installed
-
Apr 13th, 2011, 09:58 AM
#6
Re: how to connect to UNIX using vbscript
 Originally Posted by arijitghosh21
What are the necessary component..Vb is not installed
Read this for more information.
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
-
Apr 16th, 2011, 02:45 AM
#7
Thread Starter
New Member
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.
-
Apr 18th, 2011, 03:48 PM
#8
Re: how to connect to UNIX using vbscript
What is the error that you are getting?
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|