Windows Vista Forums

script to determine PC's IP subnet

  1. #1


    tree leafs Guest

    script to determine PC's IP subnet

    Hi,
    I am looking for some startup script that can detect PC's IP subnet.
    Thanks in advance.





      My System SpecsSystem Spec

  2. #2


    Pegasus [MVP] Guest

    Re: script to determine PC's IP subnet



    "tree leafs" <treeleafs@newsgroup> wrote in message
    news:#v2zCWC7KHA.5808@newsgroup

    > Hi,
    > I am looking for some startup script that can detect PC's IP subnet.
    > Thanks in advance.
    This code fragment uses WMI to return the PC's IP address. You can easily
    extract the subnet.

    Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
    Set colNetAdapters = objWMIService.ExecQuery _
    ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=True")

    For Each objNetAdapter In colNetAdapters
    WScript.Echo "IP_Address=" & objNetAdapter.IPAddress(0)
    Next



      My System SpecsSystem Spec

script to determine PC's IP subnet

Similar Threads
Thread Thread Starter Forum Replies Last Post
by subnet, how to determine all ip adress(alive or not) and dnsassociated usri VB Script 1 05 Apr 2010
script to determine password expire date and send email notificati Eero J PowerShell 43 09 Oct 2009
Script to run only on a given subnet Glenn VB Script 4 09 Feb 2009
Determine if script was run from command prompt cwhankey VB Script 1 17 Oct 2008
how to determine a script location? Jeff Jarrell PowerShell 6 01 Jun 2007