Bonjour,
je souhaite pouvoir modifier mon adresse IP en utlisant VB.NET et WMI.

J'ai le code suivant, qui s'exécute sans aucune erreur, mais les modifications ne sont pas prises en compte....

QQ'un peut il me donner un coup de main please?? Merci.

Code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
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