SQL Query for getting IP address and Gateway for a list of machines

Posted on Posted in SQL Query

Hi Guys,

I know that finding IP address of a machine is much easier by  just pinging. But in most of environments that I have seen even Ping is disabled via Firewall(I don’t know what level of security they were trying to achieve???? ), so in such cases if you are a SCCM Admin, you have an alternate source from where you can find out the Network Details and that is SCCM Database. Try below query to fetch the information. It will generate the IP address and IP Gateway Details with details of timestamp when they had this IP address.

select distinct rs.Name0,
nd.IPAddress00 As ‘IP Address’,
nd.DefaultIPGateway00 as ‘IP Gateway’,
nd.TimeKey
from Network_DATA nd inner join v_r_system rs on nd.MachineID=rs.ResourceID
where IPAddress00 is not Null and rs.Name0 in (YOUR MACHINES HERE IN SINGLE QUOTE SEPARATED WITH COMMAS)
order by TimeKey desc

Please let me know for queries in the comments below.

Until Next time,

Reyaz Ahmed

The post SQL Query for getting IP address and Gateway for a list of machines appeared first on Experts Advise.

Leave a Reply

Your email address will not be published. Required fields are marked *