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 Forum
by subnet, how to determine all ip adress(alive or not) and dnsassociated VB Script
script to determine password expire date and send email notificati PowerShell
Script to run only on a given subnet VB Script
Determine if script was run from command prompt VB Script
how to determine a script location? PowerShell