Results 1 to 8 of 8

Thread: how to connect to UNIX using vbscript

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    4

    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.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: how to connect to UNIX using vbscript

    Welcome to VBForums

    Thread moved from 'VB6 and Earlier' forum to 'VBScript' forum

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    4

    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&#37;">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%">&nbsp;</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

  4. #4
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    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

  5. #5

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    4

    Re: how to connect to UNIX using vbscript

    What are the necessary component..Vb is not installed

  6. #6
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Re: how to connect to UNIX using vbscript

    Quote Originally Posted by arijitghosh21 View Post
    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

  7. #7

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    4

    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.

  8. #8
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    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
  •  



Click Here to Expand Forum to Full Width