Get mac via VB 2010

Fermé
executor - 29 sept. 2011 à 11:13
Nico# Messages postés 323 Date d'inscription vendredi 4 janvier 2008 Statut Membre Dernière intervention 28 août 2013 - 29 sept. 2011 à 18:54
Bonjour,

je suis un débutant en vb et je jeux si c'est possible de m'aidez a trouver comment lire une adresse mac de mon PC avec un script vb 2010, merci bien .
A voir également:

1 réponse

Nico# Messages postés 323 Date d'inscription vendredi 4 janvier 2008 Statut Membre Dernière intervention 28 août 2013 102
29 sept. 2011 à 18:54
Slt,
tu peut faire comme ceci

Imports System
Imports System.Management
Imports System.Windows.Forms

Namespace WMISample

    Public Class AdresseMac

        Public Overloads Shared Function Main() As Integer

            Try
                Dim searcher As New ManagementObjectSearcher( _
                    "root\CIMV2", _
                    "SELECT * FROM Win32_NetworkAdapterConfiguration") 

                For Each queryObj As ManagementObject in searcher.Get()

                    Console.WriteLine("-----------------------------------")
                    Console.WriteLine("Win32_NetworkAdapterConfiguration instance")
                    Console.WriteLine("-----------------------------------")
                    Console.WriteLine("MACAddress: {0}", queryObj("MACAddress"))
                Next
            Catch err As ManagementException
                MessageBox.Show("An error occurred while querying for WMI data: " & err.Message)
            End Try
        End Function
    End Class
End Namespace
0