May 16, 2017 at 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?
May 16, 2017 at 1:26 pm
Hi,
Can you try the DMV sys.dm_exec_connections (look for the client_net_address column in the resultset)?
Thanks.
May 16, 2017 at 2:01 pm
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 windowsimport-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
May 16, 2017 at 2:04 pm
mandavli - Tuesday, May 16, 2017 1:14 PMI 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