Jump to content

Assign IP based on MAC address


 Share

Recommended Posts


More information would also be of help to further responders.

Have you just got a list of MAC Addresses, have you got a list of MAC Addresses each accompanied by a required IP Address and SubNet. etc.

Link to comment
Share on other sites

Something like this vbscript will get you a PC's MAC address:

' ----------

'

Dim objNetworkAdapters, objAdapter, objWMI

Set objWMI = Nothing

Set objWMI = GetObject("winmgmts:")

' Get a list of IP-enabled adapters

Set objNetworkAdapters = objWMI.ExecQuery("select * from Win32_NetworkAdapterConfiguration where IPEnabled = 1")

For Each objAdapter In objNetworkAdapters

wscript.echo "Network adapter: " & objAdapter.Caption & " has MAC address " & objAdapter.MacAddress

'

' ----------

What you do with that information is up to you :), but at least you can now have the MAC address of each machine.

Link to comment
Share on other sites

If you have so many computers that you need a script to do this, then that means you really should be running a DHCP server and using reservations. I know that reservations defeat half the purpose of DHCP, but still it's a hell of a lot easier to change a DNS server assignment on 100 workstations via DHCP than to physically visit each one (or even to script that out too).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.


×
×
  • Create New...