Skip to content

Instantly share code, notes, and snippets.

@jonman364
Created November 4, 2014 15:59
Show Gist options
  • Save jonman364/06901efc1f2aef8fc7a7 to your computer and use it in GitHub Desktop.
Save jonman364/06901efc1f2aef8fc7a7 to your computer and use it in GitHub Desktop.
Option Explicit
Dim oWim, items, item, info, comp
comp = "."
If WScript.Arguments.Count > 0 Then
comp = WScript.Arguments.Item(0)
End If
Set oWim = GetObject("winmgmts:\\" & comp & "\root\cimv2")
Set items = oWim.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE DNSDomain IS NOT NULL")
For Each item In items
info = info & item.IPAddress(0) & ": " & item.MACAddress & VBNewLine
Next
WScript.Echo info
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment