Get Ip Address of Servers on network and Check if services are running

  • I have ADSI Linked Server created on Server , I am able to get computer names from using TSQL,
    How can I get IP Addresses of all the computers  on the network and services that running and responding?

  • Hi,

    Can you try the DMV sys.dm_exec_connections (look for the client_net_address column in the resultset)?

    Thanks.

  • I've done something like thisrequest, but via powershell; you have a lot more versatility there than pinging stuff via xp_cmdshell
    regardless of where you do it, the logic is basically the same:

    you can query AD for a list of all computers that ever registered with AD(so lots of ghosts) (ie with Get-ADComputer)  and filter whether it's a server or workstation.
    then you can ping each one and see if it answers. either way, you want to log the response as ping-able/not ping-able in a table.
    here's an example that gets all the workstations (Non-Server) machines that are also running some flavor of windows
    import-module ActiveDirectory

    $DomainDNS = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().Name #Get AD Domain (lightweight & fast method)
      [array] $AllWorkstations = Get-ADComputer -filter { (OperatingSystem -like "*Windows*")
                     -and (OperatingSystem -notlike "*Server*")
                     -and (Enabled -eq $True) } -properties Name, ServicePrincipalNames, DistinguishedName, OperatingSystem, passwordLastSet
    ##Review the list of workstations
    $AllWorkstations | Out-GridView
    ForEach ($Computer in $AllWorkstations | Where { $_.Name -notin $wkexcluded })
         { ## OPEN ForEach
         $Computer.Name
         $lookup = nslookup $Computer -ErrorAction SilentlyContinue
          if($lookup)
          {     
          $ping = test-connection -ComputerName $Computer -count 3
           if($ping)
            {
            Get-WmiObject -Namespace "root\cimv2" -Class Win32_processor -ComputerName $Computer | select Caption
            }
          }
          #else
          #{
          #  write-host "Failure $Computer"
          #  write-host ""
          #}
        
         } ## CLOSE ForEach

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • mandavli - Tuesday, May 16, 2017 1:14 PM

    I have ADSI Linked Server created on Server , I am able to get computer names from using TSQL,
    How can I get IP Addresses of all the computers  on the network and services that running and responding?

    Don't think you're going to find that information in Active Directory.
    PowerShell may be a better tool to get the IP addresses and services - using Test-Connection and Get-Services. Or Get-ADComputer can get the IP addresses from DNS when getting the ip4address property. Lots of examples of feeding a list of computers from a text file to Powershell and getting services, IP addresses, etc.

    Sue

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply