• VBS – IP Address

    Author
    Topic
    #404767

    Does anyone know whether it is possible to return the IP address of a PC within VB Script – I want to create a script that my users can run that returns their IP address in a message box.

    TIA,

    Viewing 6 reply threads
    Author
    Replies
    • #825860

      Well this isn’t a scripting answer, but couldn’t you do it with a simple batch file on the user machines, using either NBTSTAT or IPCONFIG or whatever, using the pause command to keep the window open until they press a key?

    • #825861

      Well this isn’t a scripting answer, but couldn’t you do it with a simple batch file on the user machines, using either NBTSTAT or IPCONFIG or whatever, using the pause command to keep the window open until they press a key?

    • #825898

      Not VB script, but would this javascript code from the JavaScript Source do?

    • #825899

      Not VB script, but would this javascript code from the JavaScript Source do?

    • #826172

      The last time I researched this, a couple of years ago, the answer was that you needed to use either Server Side Includes (SHTML) or ASP, if you are hosting on a Microsoft web server (IIS). An ordinary web page (HTM or HTML) does not seem to have access to the HTTP headers sent by the browser.

      I wish I still had the code handy, because there was a neat trick. Oh wait, maybe I posted it. Searching… searching… got it! See post 129006. (Incidentally, that prank was extremely well received.)

      • #898449

        By complete coincidence, I came across a VBS script that does the job and am posting for future reference.

        You can find (and download) a script at http://www.billsway.com/vbspage/%5B/url%5D – look for the “Get IP Address” script. Note that all scripts on this site are copyrighted by Bill James and the usual disclaimers apply.

        Cheers,

        • #898680

          For anyone interested in this script, what it appears to do is run the command line ipconfig program (or in Windows 9x systems, winipcfg), capture its output to a file, and then extract the user’s IP address from there. In looking at my original post, I obviously was assuming that the script would have to run inside a browser. Running directly off the PC provides many more options. smile

        • #898681

          For anyone interested in this script, what it appears to do is run the command line ipconfig program (or in Windows 9x systems, winipcfg), capture its output to a file, and then extract the user’s IP address from there. In looking at my original post, I obviously was assuming that the script would have to run inside a browser. Running directly off the PC provides many more options. smile

      • #898450

        By complete coincidence, I came across a VBS script that does the job and am posting for future reference.

        You can find (and download) a script at http://www.billsway.com/vbspage/%5B/url%5D – look for the “Get IP Address” script. Note that all scripts on this site are copyrighted by Bill James and the usual disclaimers apply.

        Cheers,

    • #826230

      Many thanks for all the pointers – much appreciated. Javascript looks like the way forward for my needs.

      Thanks again,

    • #826231

      Many thanks for all the pointers – much appreciated. Javascript looks like the way forward for my needs.

      Thanks again,

    Viewing 6 reply threads
    Reply To: VBS – IP Address

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: