레드후디의 탐구생활

[WMI] 자신의 MAC Address 얻기 본문

DEVELOPMENT/dot NET

[WMI] 자신의 MAC Address 얻기

레드후디 2011.01.27 20:46

 

'자신의 MAC Address를 얻는다.

    Private Function _fGetMyMACAddress() As String

        Dim WMI As ManagementClass

        Dim WMIObjColl As ManagementObjectCollection

        Dim WMIObj As ManagementObject

        Dim strMyMacAddress As String

 

        WMI = New ManagementClass("Win32_NetworkAdapterConfiguration")

        WMIObjColl = WMI.GetInstances()

 

        For Each WMIObj In WMIObjColl

            If WMIObj.Item("IPEnabled") = True Then

                strMyMacAddress = WMIObj.Item("MacAddress").ToString()

                WMIObj.Dispose()

                WMIObj = Nothing

                Exit For

            End If

            WMIObj.Dispose()

            WMIObj = Nothing

        Next

 

        WMIObjColl.Dispose()

        WMI.Dispose()

        Return strMyMacAddress

    End Function

'DEVELOPMENT > dot NET' 카테고리의 다른 글

[.NET]일괄 초기화 (batch initialization)  (0) 2011.02.27
[WMI] 자신의 MAC Address 얻기  (0) 2011.01.27
[.NET] AppDomain의 실행URL(현재URL)  (1) 2011.01.21
[.NET] Assembly 동적 로드  (0) 2011.01.21
0 Comments
댓글쓰기 폼