Je suis allé fureter sur msdn et j'ai trouvé ça :
WMI Tasks: Networking
WMI
tasks for networking manage and obtain information about connections
and IP or MAC addresses. For other examples, see the TechNet
ScriptCenter at http://www.microsoft.com/technet.
The
script examples shown in this topic obtain data only from the local
computer. For more information about how to use the script to obtain
data from remote computers, see Connecting to WMI on a Remote Computer.
The following procedure describes how to run a script.
To run a script
- Copy
the code and save it in a file with a .vbs extension. Ensure that your
text editor does not add a .txt extension to the file.
- Open a command prompt window and navigate to the directory where you saved the file.
- Type cscript scriptfile.vbs at the command prompt.
Note By default, cscript displays the output of a script in the command prompt window. Because WMI scripts can
produce large amounts of output, you might want to redirect the output to a file. Type cscript scriptfile.vbs > outfile.txt at
the command prompt to redirect the output of the filename.vbs script to outfile.txt.
The following table lists script examples that can be used to obtain various types of data from the local computer.
| How do I... | WMI classes or methods |
|---|
| ...disable a network connection using WMI? | If you are using DHCP, use the Win32_NetworkAdapterConfiguration and the ReleaseDHCPLease
method to release the IP address. If you are not using DHCP, you cannot
use WMI to disable a network connection. To re-enable the network
connection, use objNetCard.RenewDHCPLease. You can also release or renew all of the DHCP leases using the ReleaseDHCPLeaseAll and RenewDHCPLeaseAll methods. strComputer = "." Set objWMIService = GetObject( _ "winmgmts:\\" & strComputer & "\root\cimv2") Set colNetCards = objWMIService.ExecQuery _ ("Select * From Win32_NetworkAdapterConfiguration " _ & "Where IPEnabled = True") For Each objNetCard in colNetCards objNetCard.ReleaseDHCPLease() Next |
Avant d'essayer ce truc j'aimerais m'assurer qu'à priori ce sont ces fonctions qu'il faut utiliser car mon anglais est approximatif ;-)
A votre avis, ces méthodes ont des chances de fonctionner ?
Merci
Bongenie