Announcement

Collapse
No announcement yet.

Pleae help in getting IP address of all the PC in OU.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pleae help in getting IP address of all the PC in OU.

    Hi All,

    Can somebody help me in getting the IP address of all the pc in OU. I dont have access to DHCP Sever. I am OU admin.

    Thanks in advance.

    Regards,
    Subbu

  • #2
    Re: Pleae help in getting IP address of all the PC in OU.

    You can right click on the OU in AD Users & Computers and export list. That will give you a text file that you can either turn into a batch file or use as input to some other program.

    Aside from that, what are you really trying to accomplish? I hardly ever care about IP address lists. I just use the PC name for what I need to do.

    Comment


    • #3
      Re: Pleae help in getting IP address of all the PC in OU.

      Maybe this batch can?

      Code:
      ::  batch_script  
      :: Author: Remco Simons, NL 2008
      :: Source: http://forums.petri.com/showthread.php?t=25888
      
      @echo off
      SETLOCAL ENABLEDELAYEDEXPANSION
      
      :: Enumerate the computerobjects in one OU
      (Set startnode=ou=Sales,ou=portables,ou=All Computers,dc=domain,dc=local)
      
      (Set exportfile=c:\ClientIP.txt)
      If exist "%exportfile%" Del "%exportfile%"
      
      ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
      
      set "_Title= Querying Active Directory . . . "
      
      cls & Color 6B & Set "iCnt=0"
      echo.Wait...
      
      FOR /F %%* IN (
         'DSQUERY.exe COMPUTER "%startnode%" -scope onelevel -O sAmid'
         ) DO (
            SET "SAMID=%%*" & (SET SAMID=!SAMID:~1,-2!)
            SET/a iCnt=!iCnt!+1 & Title %_Title% [!iCnt!]
            For /f "tokens=2* delims=[]" %%! in (
                    'PING.exe -n 1 -w 0 !SAMID!') Do (
                       Set "strIP=%%!"
            )
            echo.!SAMID!	!strIP!
      ) >> "%exportfile%"
      
      cls&echo.&echo.done
      echo.Press any key to close this window . . .
      pause>nul
      \Rems
      Last edited by Rems; 18th July 2008, 22:41. Reason: added colors

      This posting is provided "AS IS" with no warranties, and confers no rights.

      __________________

      ** Remember to give credit where credit's due **
      and leave Reputation Points for meaningful posts

      Comment


      • #4
        Re: Pleae help in getting IP address of all the PC in OU.

        I use a very simple logon script. Then I just sort through the folder to get whatever info I need from a particular user. Works great and I use it all the time.

        ipconfig /all > \\server\folder\%username%@%computername%.txt

        Comment


        • #5
          Re: Pleae help in getting IP address of all the PC in OU.

          You can use simple adfind query and get the name of the computers in the text file
          C:\WINNT\system32>adfind /b OU=Workstations,DC=bala,
          DC=com
          -f objectcategory=computer dn >c:\test.txt

          once it is completed you can use for loop to generate the ping result.

          for /f "delims==, tokens=1,2" %a in (c:\test.txt) do ping -n 1 %b >>test1.

          hope this helps

          cheers, Bala

          Comment

          Working...
          X