Astrotolus
07-04-2005, 10:09 PM
I'm writing a vb script to extract the MAC from a workstation and write it as the computer name. I have a working solution now but it's a bit clumsy.
I have a batch file that calls "getmac /fo table /nh >> c:\mac.txt", then calls a vb script file which reads the MAC address from the file, writes the name then restarts the computer.
I'm sure there must be an easier way to get the MAC, avoid using the text file and have a complete solution with just vbs. I haven't been able to find the MAC in the registry, but I know it's possible (though I don't know how exactly) to read the MAC using Windows Management Instrumentation (WMI).
So, I was hoping someone could help we out with some vbs code to write the MAC into a variable. From there I should be able to get it going. I'll give the rest of the script, small as it is, to anyone who can help me out.
Thanks.
I have a batch file that calls "getmac /fo table /nh >> c:\mac.txt", then calls a vb script file which reads the MAC address from the file, writes the name then restarts the computer.
I'm sure there must be an easier way to get the MAC, avoid using the text file and have a complete solution with just vbs. I haven't been able to find the MAC in the registry, but I know it's possible (though I don't know how exactly) to read the MAC using Windows Management Instrumentation (WMI).
So, I was hoping someone could help we out with some vbs code to write the MAC into a variable. From there I should be able to get it going. I'll give the rest of the script, small as it is, to anyone who can help me out.
Thanks.