| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 
 |  
 Dim inPar As ManagementBaseObject = Nothing
        Dim outPar As ManagementBaseObject = Nothing
        Dim mc As ManagementClass = New ManagementClass("Win32_NetworkAdapterConfiguration")
        Dim moc As ManagementObjectCollection = mc.GetInstances
 
        For Each mo As ManagementObject In moc
            If CType(mo("IPEnabled"), Boolean) Then
                inPar = mo.GetMethodParameters("EnableStatic")
                inPar("IPAddress") = New String() {"IP"}
                inPar("SubnetMask") = New String() {"Masque"}
                'inPar("DefaultIPGateway") = New String() {"Passerelle"}
                outPar = mo.InvokeMethod("EnableStatic", inPar, Nothing)
                Exit For
            End If
        Next | 
Partager