• Retrieving IP addresses

    Author
    Topic
    #442243

    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.

    Viewing 2 reply threads
    Author
    Replies
    • #1064064

      In DHCP you export a list of IP address leases

    • #1064067

      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

    • #1064075

      If you can guarantee that all the PCs are powered up, there are at least two ways I can think of:

      • process the results from PINGing the list of computer names OR each IP address in the range, with a BATch file, and
      • 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

        	for /f %a in (pcnames) do ping -n 1 %a | find "Pinging" >> pcipaddr.txt

        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:

      • #1064095

        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.

        • #1064122

          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

          • #1064129

            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?

            • #1064132

              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

            • #1064159

              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

            • #1064222

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

              John

    Viewing 2 reply threads
    Reply To: Retrieving IP addresses

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: