Windows Vista Forums

vb script on vista X64 not working

  1. #1



    Newbie
    Join Date : Oct 2008
    Posts : 6
    vista x64 ultimare
    Local Time: 07:12 AM

    vb script on vista X64 not working

    the script below works perfectly on vista32 - but on X64 is reports it cannot find the file on line 21

    it is for acceessing a remote computer

    i know nothing about vb - just found the script in a forum

    i have turned telnet on and that is working

    can anybody help

    thanks

    tony



    script below

    ServerName = "192.168.1.9"
    Username = "admin" ' Current Username
    Passwd = "nas" ' Current Password
    XIT = "E" ' Used to "EXIT" from NAS. (upper-case E)
    YES = "y" ' Used to confirm an option. (lower-case Y)
    SHUT = "8" ' Used to SHUTDOWN NAS. (number eight)
    DELAY = 250 ' Minimum 500ms recommended; 1000 works well.

    ' --------------------------------------------------------------------
    ' SECTION B: Start a Shell
    ' --------------------------------------------------------------------
    Set WshShell = WScript.CreateObject("WScript.Shell")

    ' --------------------------------------------------------------------
    ' SECTION C: Start the TELNET
    ' --------------------------------------------------------------------
    WshShell.Run "telnet " + ServerName
    ' --------------------------------------------------------------------
    ' SECTION D: Login. ("Sleep" pauses are needed delays.)
    ' --------------------------------------------------------------------
    WScript.Sleep DELAY
    WshShell.SendKeys Username + vbLf
    WScript.Sleep DELAY
    WshShell.SendKeys Passwd + vbLf



      My System SpecsSystem Spec

  2. #2


    Monitor Guest

    Re: vb script on vista X64 not working


    "adacom" <guest@xxxxxx-email.com> wrote in message
    news:26acd3d36a924dccb1c10cb91f47494b@xxxxxx-gateway.com...

    >
    > the script below works perfectly on vista32 - but on X64 is reports it
    > cannot find the file on line 21
    >
    > it is for acceessing a remote computer
    >
    > i know nothing about vb - just found the script in a forum
    >
    > i have turned telnet on and that is working
    >
    > can anybody help
    >
    > thanks
    >
    > tony
    >
    >
    >
    > script below
    >

    > > ServerName = "192.168.1.9"
    > > Username = "admin" ' Current Username
    > > Passwd = "nas" ' Current Password
    > > XIT = "E" ' Used to "EXIT" from NAS. (upper-case E)
    > > YES = "y" ' Used to confirm an option. (lower-case Y)
    > > SHUT = "8" ' Used to SHUTDOWN NAS. (number eight)
    > > DELAY = 250 ' Minimum 500ms recommended; 1000 works well.
    > >
    > > ' --------------------------------------------------------------------
    > > ' SECTION B: Start a Shell
    > > ' --------------------------------------------------------------------
    > > Set WshShell = WScript.CreateObject("WScript.Shell")
    > >
    > > ' --------------------------------------------------------------------
    > > ' SECTION C: Start the TELNET
    > > ' --------------------------------------------------------------------
    > > WshShell.Run "telnet " + ServerName
    > > ' --------------------------------------------------------------------
    > > ' SECTION D: Login. ("Sleep" pauses are needed delays.)
    > > ' --------------------------------------------------------------------
    > > WScript.Sleep DELAY
    > > WshShell.SendKeys Username + vbLf
    > > WScript.Sleep DELAY
    > > WshShell.SendKeys Passwd + vbLf
    >
    >
    > --
    > adacom
    As a matter of courtesy towards respondents it would be a great idea to
    point out which line is line 21. This would also eliminate any confusion
    arising from leading blank lines.



      My System SpecsSystem Spec

  3. #3



    Newbie
    Join Date : Oct 2008
    Posts : 6
    vista x64 ultimare
    Local Time: 07:12 AM


      Thread Starter

    Re: vb script on vista X64 not working

    not understanding vb i have to guess which is line 21 - i am assuming blank lines are counted so this would seem to be the error line -or maybe they all are faulty and line 21 is the first faulty line

    WshShell.Run "telnet " + ServerName
    sorry i cannot be sure - that was the reason for my post

      My System SpecsSystem Spec

  4. #4


    Pegasus \(MVP\) Guest

    Re: vb script on vista X64 not working


    "adacom" <guest@xxxxxx-email.com> wrote in message
    news:9da40364818de2ef38e3706996edd426@xxxxxx-gateway.com...

    >
    > not understanding vb i have to guess which is line 21 - i am assuming
    > blank lines are counted so this would seem to be the error line -or
    > maybe they all are faulty and line 21 is the first faulty line
    >

    >> WshShell.Run "telnet " + ServerName
    >
    > sorry i cannot be sure - that was the reason for my post
    >
    >
    > --
    > adacom
    Use notepad.exe to look at your source code, then count your lines. To be
    really sure, insert some labels like so:

    ServerName = "192.168.1.9"

    > Username = "admin" ' Current Username
    > Passwd = "nas" ' Current Password
    > XIT = "E" ' Used to "EXIT" from NAS. (upper-case E)
    > YES = "y" ' Used to confirm an option. (lower-case Y)
    > SHUT = "8" ' Used to SHUTDOWN NAS. (number eight)
    > DELAY = 250 ' Minimum 500ms recommended; 1000 works well.
    >
    > ' --------------------------------------------------------------------
    > ' SECTION B: Start a Shell
    > ' --------------------------------------------------------------------
    > Set WshShell = WScript.CreateObject("WScript.Shell")
    wscript.echo "Label 1"
    ' --------------------------------------------------------------------
    ' SECTION C: Start the TELNET
    ' --------------------------------------------------------------------
    wscript.echo "Label 2"
    WshShell.Run "telnet " + ServerName
    ' --------------------------------------------------------------------
    ' SECTION D: Login. ("Sleep" pauses are needed delays.)
    ' --------------------------------------------------------------------
    wscript.echo "Label 3"

    > WScript.Sleep DELAY
    > WshShell.SendKeys Username + vbLf
    > WScript.Sleep DELAY
    > WshShell.SendKeys Passwd + vbLf
    Now invoke your script from the Command Prompt like so:
    cscript.exe //nologo c:\MyScript.vbs



      My System SpecsSystem Spec

  5. #5



    Newbie
    Join Date : Oct 2008
    Posts : 6
    vista x64 ultimare
    Local Time: 07:12 AM


      Thread Starter

    Re: vb script on vista X64 not working

    thanks

    done some checking and it is as i thought - line 21 in my original posted code is

    WshShell.Run "telnet " + ServerName

      My System SpecsSystem Spec

  6. #6


    Pegasus \(MVP\) Guest

    Re: vb script on vista X64 not working


    "adacom" <guest@xxxxxx-email.com> wrote in message
    news:04f3bc9291f7aea763f221a8eee3e2e7@xxxxxx-gateway.com...

    >
    > thanks
    >
    > done some checking and it is as i thought - line 21 in my original
    > posted code is
    >

    >>
    >> WshShell.Run "telnet " + ServerName
    >>
    >
    >
    > --
    > adacom
    A few observations:
    - Does "telnet.exe" exist?
    - Where does it reside?
    - Is its location included in the %path%?
    - What happens when you type "telnet" (without the quotes) at the Command
    Prompt?

    Also:
    - What are you actually trying to do with this script?
    - To concatenate strings in VB Scripts, use the & symbol, not the + symbol.
    - To make your script more robust, make it "telnet.exe" instead of just
    "telnet".
    - To avoid confusion, change "ServerName" to "ServerIP" throughout the
    program.
    - Since I don't have ready access to a 64-bit machine I cannot test your
    code. It might be safer to invoke the Run method like so:
    WshShell.Run "cmd.exe /c telnet.exe " + ServerName




      My System SpecsSystem Spec

  7. #7



    Newbie
    Join Date : Oct 2008
    Posts : 6
    vista x64 ultimare
    Local Time: 07:12 AM


      Thread Starter

    Re: vb script on vista X64 not working

    Quote Originally Posted by Pegasus \(MVP\) View Post
    "adacom" <guest@xxxxxx-email.com> wrote in message
    news:04f3bc9291f7aea763f221a8eee3e2e7@xxxxxx-gateway.com...
    >
    > thanks
    >
    > done some checking and it is as i thought - line 21 in my original
    > posted code is
    >
    >>
    >> WshShell.Run "telnet " + ServerName
    >>
    >
    >
    > --
    > adacom
    A few observations:
    - Does "telnet.exe" exist?
    - Where does it reside?
    - Is its location included in the %path%?
    - What happens when you type "telnet" (without the quotes) at the Command
    Prompt?

    Also:
    - What are you actually trying to do with this script?
    - To concatenate strings in VB Scripts, use the & symbol, not the + symbol.
    - To make your script more robust, make it "telnet.exe" instead of just
    "telnet".
    - To avoid confusion, change "ServerName" to "ServerIP" throughout the
    program.
    - Since I don't have ready access to a 64-bit machine I cannot test your
    code. It might be safer to invoke the Run method like so:
    WshShell.Run "cmd.exe /c telnet.exe " + ServerName
    telnet exists - i can run it from a command prompt - not sure where it is - i simply tyle telnet and it runs

    its not my script - it is for controlling the software that runs a nas server from windows

    it works perfectly in 32bit vista - but gives the errow when run on 64 bit vista

    will try some of your suggestions but it will be no more than trial and error as i have no knowledge of vb

      My System SpecsSystem Spec

  8. #8



    Newbie
    Join Date : Oct 2008
    Posts : 6
    vista x64 ultimare
    Local Time: 07:12 AM


      Thread Starter

    Re: vb script on vista X64 not working

    thanks all for the input -as i said i know nothing about vbscripts so what i saw looked fine - but followed the advice from Pegasus and it now works

    would just seem X64 is more picky than other versions of windows

    so thanks again am well pleased

    tony

      My System SpecsSystem Spec

  9. #9
    dmex's Avatar

    ɠɛɐǨ

    Join Date : May 2007
    Fremantle, Western Australia
    Posts : 2,632
    Windows Vista™ Ultimate
    Local Time: 01:12 PM
    australia au west australia

     

    Re: vb script on vista X64 not working

    Quote Originally Posted by adacom View Post
    thanks all for the input -as i said i know nothing about vbscripts so what i saw looked fine - but followed the advice from Pegasus and it now works

    would just seem X64 is more picky than other versions of windows

    so thanks again am well pleased

    tony
    Hi Adacom,

    I just tried your Script on VistaX64 and it worked perfectly for me?

    Steven

      My System SpecsSystem Spec

  10. #10



    Newbie
    Join Date : Oct 2008
    Posts : 6
    vista x64 ultimare
    Local Time: 07:12 AM


      Thread Starter

    Re: vb script on vista X64 not working

    thanks Steven - as it does for me now - i think it was always ok - just seemed to be where it was stored

    it was in a directory on drive d where it is/was on vista32 - on 32 it worked fine - but not on 64 - if i move it to the desktop it works

    beyond me and i am not taking it further - it works that will do

      My System SpecsSystem Spec

vb script on vista X64 not working

Similar Threads
Thread Thread Starter Forum Replies Last Post
powershell split not working from script. jlo PowerShell 6 18 Jan 2010
Logon script not working Bert SBS Server 9 06 Sep 2009
Hyper-V Startup Script Not Working Joe Virtual Server 0 27 Aug 2009
Group membership script not working-help Clubsprint VB Script 2 26 Nov 2008
why my script not working ? IT Staff PowerShell 7 15 Jul 2007