Jump to content

Recommended Posts

Posted

Hello,

I have been looking out for a vb script which will assign a specific IP based on the MAC address it reads from a txt file.

help me achieve this.

any tools/how to/guides.

thanks


Posted

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.

Posted

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.

Posted

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).

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...