Winscripter
  WSH
  Forums
  Downloads
  Books
  Links
  Amazon




Login
Register

© winscripter.com
1998-2004







Script: Find Local IP Address using MSWinsock Control

Posted by on Sunday, January 18, 2004 (PST)

Script: Finds local ip address using the MSWinsock.Winsock Control. This control is not installed by default.

 

/**
 *    Script:   LocalIP.js
 *    Purpose:  Finds Local IP Address
 *    Author:   Daren Thiel
 *    Date:     26 December 1998
 *    Web:     
http://www.winscripter.com
 *    Note:     Rename this file LocalIP.js
 **/
/* Create Winsock Object */
ws = new ActiveXObject( "MSWinsock.Winsock" );
/* Retrieve LocalIP property */
ipaddress = ws.LocalIP;
/* Let the user know about it */
WScript.Echo( "The local IP is : " + ipaddress );

Comments:

Errors
By rsbarnes on Monday, July 19, 2004 (PST)
I tried to run this script on Win2k+SP4 and got the following error: get_local_IP.js(11, 1) Microsoft JScript runtime error: Automation server can't create object

Reply to this Comment

re: Error
By rsbarnes on Monday, July 19, 2004 (PST)
Hmm, just saw the comment at the top that this control isn't part of the system.

Reply to this Comment

Add Your Comment



WSH and ADSI Administrative Scripting

New Articles
  • List installed COM objects and associated ProgIDs
    Script: Lists all COM Objects and their associated ProgIDs (If available). Win32_ClassicCOMClassSetting

  • Script: File Rotator
    Script: Rotate files where the most current file has the lowest number in the archive. When files exceed the retention period, they are deleted. Typically used for log files, backups, etc..

  • Script: Create IIS Website and DNS record
    Script: Dan Casier sent me this script that will create a website and appropriate DNS record. The script is intended for Windows 2000 Server with local DNS and necessary DNS mof installed.


  • Winscripter   |  WSH   |  Forums   |  Downloads   |  Books   |  Links   |  Amazon