(view source code of login_log_ip_mac.vbs as plain text)
' Query all network adapters that have a MAC address
strQuery = "SELECT * FROM Win32_NetworkAdapterConfiguration WHERE MACAddress > ''"
Set objWMIService = GetObject( "winmgmts://./root/CIMV2" )
Set colItems = objWMIService.ExecQuery( strQuery, "WQL", 48 )
For Each objItem In colItems
If IsArray( objItem.IPAddress ) Then
strIP = strIP & ";" & Join( objItem.IPAddress, ";" )
strMAC = strMAC & ";" & Replace( objItem.MACAddress, ":", "" )
End If
Next
Set colItems = Nothing
Set objWMIService = Nothing
' Log the result
Set objFSO = CreateObject( "Scripting.FileSystemObject" )
Set objLog = objFSO.OpenTextFile( strLog, ForAppending, True, TristateFalse )
objLog.WriteLine Mid( strIP, 2 ) & "," & Mid( strMAC, 2 )
objLog.Close
Set objLog = Nothing
Set objFSO = Nothing
page last modified: 2024-04-16; loaded in 0.0049 seconds