Results 1 to 10 of 10
  1. #1
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Retrieving IP addresses

    I have my computers set up in an AD domain. I exported the list of computers, and the only way I could think of to find each machine's IP was to run a BATch file:

    ipconfig>>serverfolderIPlist.txt

    on each machine remotely, using PSExec. Any ideas how to trim the output to only show the IP addresses? Right now, I import the text file into Excel, do some sorting/find & replace, and have my list, but I'm trying to clean up the process.
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What's more, you deserve to be hacked." -Richard Clarke

  2. #2
    4 Star Lounger
    Join Date
    Mar 2004
    Location
    Griffith, New South Wales, Australia
    Posts
    507
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Retrieving IP addresses

    In DHCP you export a list of IP address leases

  3. #3
    Administrator
    Join Date
    Mar 2001
    Location
    St Louis, Missouri, USA
    Posts
    23,571
    Thanks
    5
    Thanked 1,056 Times in 925 Posts

    Re: Retrieving IP addresses

    What server OS? If PowerShell is installed you ought to check out some of the scripts that are available. See Download details: Windows PowerShell 1.0 Documentation Pack, Scripting with Windows PowerShell, and The Script Center Script Repository: Sample Windows PowerShell Scripts.

    Joe
    Joe

  4. #4
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Retrieving IP addresses

    If you can guarantee that all the PCs are powered up, there are at least two ways I can think of:<UL><LI>process the results from PINGing the list of computer names OR each IP address in the range, with a BATch file, and <LI>a better method which uses a program (but which I'll have to be at work to hunt down!).[/list]John

    PS Later ... The program I was referring to was the Depicus ARP Viewer, which produces an HTML table if you feed it an IP address range.

    And in many of the Resource Kits there is SRVINFO, which tells you much more than you would ever want to know about the OS software in a PC, including the IP address!

    The BATch file to PING PC names to produce the IP addresses is the line<pre> for /f %a in (pcnames) do ping -n 1 %a | find "Pinging" >> pcipaddr.txt</pre>

    with some code to extract the bits you want, and some validity checking.

    Example output:
    Pinging PC26.GCVS.COM [192.168.0.121] with 32 bytes of data:
    Pinging PC27.GCVS.COM [192.168.0.101] with 32 bytes of data:
    Pinging PC28.GCVS.COM [192.168.0.126] with 32 bytes of data:
    Pinging PC29.GCVS.COM [192.168.0.127] with 32 bytes of data:
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  5. #5
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Retrieving IP addresses

    The problem was that I didn't have an IP address range; my network spans across 8 buildings, and only some of the computers in each of those buildings on any of the (up to) 5 switches in each building are my responsibility. All I had were computer names. Thanks for your suggestions, I'm looking through them right now to see if any can help me simplify what I'm trying to achieve. I have a way that "works" right now...I just want to take some of the leg work out of it.

    Also - I can't guarantee my machines are on yet, because I haven't got Wake-on-Lan on them all yet.
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  6. #6
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Retrieving IP addresses

    Since PING seems to get its initial information from DNS, it will always return the PINGing line I show, even if the PC is powered off (you get "Request timed out"). But on our system it takes 4
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  7. #7
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Retrieving IP addresses

    John,

    When trying to use your command line, I get the message "C:computers.txt was unexpected at this time." What am I doing wrong?
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  8. #8
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Retrieving IP addresses

    What I gave was a command line (as I had typed it in a Command Prompt window). If you put it into a BATch file, use %%a instead of just %a.

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

  9. #9
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Retrieving IP addresses

    I typed it in as a command line, but maybe I typed it wrong....

    for /f %a in c:computers.txt do ping -n 1 %a | find "Pinging" >> pcipaddr.txt
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  10. #10
    Platinum Lounger
    Join Date
    Jan 2001
    Location
    Quedgeley, Gloucester, England
    Posts
    5,333
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Retrieving IP addresses

    You need brackets round (c:computers.txt) -- at least you did last time you used that very filename!!

    John
    <font face="Script MT Bold"><font color=blue><big><big>John</big></big></font color=blue></font face=script>

    Ita, esto, quidcumque...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •