In a script I use I need to query all of a machine's MAC addresses. So, I pulled this function out and made it a stand alone script. Use can query by IP or by computer name.
----------COPY EVERYTHING BELOW THIS LINE---------- 'Get Coputers MAC Address 'Created by Chey Harden 8.11.08 On error resume next strComputer = (InputBox("Enter the name of the computer to get the MAC address", "Computer Name")) If strComputer <> "" Then strInput = True End if Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery _ ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True") For Each objItem in colItems Wscript.Echo objItem.MACAddress Next ----------COPY EVERYTHING ABOVE THIS LINE----------
MAKE SURE NO WORD WRAP IS HAPPENING IN YOUR SCRIPT
This information is provided "AS IS" with no warranties expressed or implied. Advertisements
|