1.    05 May 2010 #1
    tree leafs Guest

    script to determine PC's IP subnet

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

      My System SpecsSystem Spec

  2.    05 May 2010 #2
    Pegasus [MVP] Guest

    Re: script to determine PC's IP subnet

    "tree leafs" <treeleafs@newsgroup> wrote in message

    > 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)

      My System SpecsSystem Spec

Similar Threads
Thread Forum
by subnet, how to determine all ip adress(alive or not) and dnsassociated
Hello, I would like to create a vbscript with the following specs. Here are the specs: When definning the subnet how to determine all IP...
VB Script
Virtual PC on a different subnet?
We have two subnets on our network. That data is 192.168.0.X and a voice 172.24.0.X. We have Cisco switches with routing between the vlans...
Virtual Server
script to determine password expire date and send email notificati
How can I use a script to determine password-expiration dates for users in a organizational unit (OU) and send an email message to accounts whose...
Script to run only on a given subnet
Is it possible to write a startup script that will run a program such as BGinfo only if the computer is on one of a list of specified subnets? ...
VB Script
Determine if script was run from command prompt
How can I determine in my VBScipt whether the script was run from the command prompt or from double clicking in Windows Explorer? I want to pause...
VB Script
Create a subnet in AD
Hi, i don't manage to find an exemple of creating Subnet script. It's more special than creat just simple user, it's on the configuration partition...
how to determine a script location?
Inside a basic .PS1 script how do I determine the location of the PS1. What i am doing is I want to locate a config file which will be located in...

Our Sites
  • Ten Forums
  • Eight Forums
  • Seven Forums
  • PC Help Forum
  • Help Me Bake
  • Site Links
  • Contact Us
  • Privacy and Cookies
  • About Us
    Windows Vista Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

    Designer Media Ltd
    All times are GMT -5. The time now is 00:08.