McNeel Wiki
How To: Obtain the Physical Address of a Computer
edit · print · help · all topics
Main Pages

AccuRender

Bongo

Brazil r/s

Developer

Flamingo

Penguin

Rhino Blogs

Rhino

Rhino Labs

Search

Languages

Česky

Deutsch

English

Español

Français

Italiano

Polish

日本語

한국어

中文(繁體)

中文(简体)

 
.
DeveloperRhinoScript
SummaryIllustrates RhinoScript code that determines the physical, or MAC, address of a computer.

The following RhinoScript uses the Windows Management Instrumentation (WMI) to determine the physical addresses, or MAC addresses, of a computer.

  Sub PrintMacAddress


    Dim strComputer
    strComputer = "."


    Dim objWMIService
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")


    Dim colAdaptors
    Set colAdapters = objWMIService.ExecQuery _
        ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")


    Dim n
    n = 1


    For Each objAdapter In colAdapters
     Rhino.Print ""
     Rhino.Print "Network Adapter " & n
     Rhino.Print "  Description: " & objAdapter.Description
     Rhino.Print "  Physical (MAC) address: " & objAdapter.MACAddress
     n = n + 1
    Next


  End Sub
rename · changes · history · subscriptions · lost and found · references · file upload