Link to home
Start Free TrialLog in
Avatar of bsharath
bsharathFlag for India

asked on

Ca we find all static ip's in a domain

Hi,

Is there a code or script to find all Static ip's in the domain.We have a DHCP server too.

Regards
Sharath
Avatar of ranadastidar
ranadastidar

arp -a
run the DHCP on your dhcp server, your should see a tab or folder called " DHCP leased" , it will show you which are static, which are dynamic.
Well hoping that you have things setup right your DHCP server is going to be providing leases to a range of I.P. address' for example (192.168.1.2 – 100) these can be omited from the static ip's as you never want to assign a static ip in your dhcp range unless you like to have ip conflicts every once an a while.

there is no remote way to tell if the ip address is a static or dynamic ip its only the client that is privy to that information, and that can be found out how ranadastidar sugested, arp -a. however because we know the range of the dhcp server we can assume that any ip outside the specified range is static.

You can find what ip’s are occupied in your static range (that is if you don’t know) by doing a ping scan. This will send out pings to the ip’s in question and look for responces. Note that this will only work if your computers don’t have a software based firewall blocking icmp network traffic.

Hope that helps.
Avatar of Pber
This might work...

Do you have Microsoft DNS?   If so and if you maintain your static IP's in DNS manually you can do a dump of dns and filter out all the DDNS records which would be all your DHCP'd clients in this situation.  It's not the most elequent way of doing it...

dnscmd yourdnsservername /enumrecords your.zone.com @ /Type A >c:\a.txt

This will dump all the A records from DNS.  Now all the output of the file will have items like this:

PC44 [Aging:3554644] 900 A   192.168.32.109
PC34 14400 A 192.168.77.71

Any items with the Aging would signify a DDNS records and would most likely be a DDNS record.  I say most likely because you can still have static IP on a client and still have them register in DNS.  A static DNS record in DNS can also be aged.  But if you manually enter your computers with static IP's in DNS manually, this will be very accurate.

So you can load it up in excel or some other editor and filter out or search/delete the records that have Aging in them and the ones that are remaining would be static IP's
Look at http://www.solarwinds.net/Toolsets.htm.

If you are looking to find IP addresses that are alive on your network - both static and DHCP.
Turn off your dhcp server and see who complains tomorrow.
ASKER CERTIFIED SOLUTION
Avatar of SMFX
SMFX

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bsharath

ASKER

Hi,

i get this error

C:\>cscript test.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

C:\test.vbs(61, 6) (null): 0x80041003
That looks like an access is denied error.  Most likely the account you ran the script under is not an admin of the remote machine you attempted to connect to.  If you remove the tick mark commenting the line out just before it:
      WScript.Echo sComputer            'For debugging purposes
It will show you what machine it was trying to connect to.

-SMFX
Hi,

This worked but after scanning 20 pc's it gives and error

C:\test.vbs(61, 6) Microsoft VBScript runtime error: Permission denied: 'GetObject'

I have logged in as a domain admin only

that is a problem with WMI and VBScripts.  When it doesn't connect right, it bombs out.  You can try adding "On Error Resume Next" as the first line and it should try to bounce over it.

And you're sure that the Domain Admin is a member of the local admins on the 21st machine?

-SMFX
You are a genius.Great work boss.
Glad to help!
-SMFX