Informations réseau (VBScript)
Le script suivant affiche une boîte de message avec les informations réseau, comme un ipconfig sous DOS.
Code VisualBASIC ou VBA ou VBS (script vbs : ipconfig) (34 lignes)
Dim strComputer Dim colDrives, strMsg Dim WSHNetwork strComputer = "." Set NetworkPROP = WScript.CreateObject("WScript.Network") Set objWMIService = GetObject _ ("winmgmts:" & "!\" & strComputer & "\root\cimv2") Set colAdapters = objWMIService.ExecQuery _ ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True") For Each objAdapter in colAdapters Msgbox "UserName " & vbTab & "=" & NetworkPROP.UserName & vbCrLf & _ "Host name: " & vbTab & "=" & objAdapter.DNSHostName & vbCrLf & _ "IP address: " & vbTab & "=" & objAdapter.IPAddress(i) & vbCrLf & _ "Description: " & vbTab & "=" & objAdapter.Description & vbCrLf & _ "User Domain: " & vbTab & "=" & NetworkPROP.UserDomain & vbCrLf & _ "Physical address: " & vbTab & "=" & objAdapter.MACAddress & vbCrLf & _ "DHCP enabled: " & vbTab & "=" & objAdapter.DHCPEnabled, _ vbinformation + vbOKOnly + vbmsgboxsetforeground, _ "PROPRIETES RESEAU " Next Set colDrives = NetworkPROP.EnumNetworkDrives If colDrives.Count = 0 Then MsgBox "AUCUN LECTEUR RESEAU ACTIF.", _ vbInformation + vbOkOnly, _ L_Welcome_MsgBox_Title_Text Else strMsg = "CONNECTIONS ACTIVES : " & vbCrLf For i = 0 To colDrives.Count - 1 Step 2 strMsg = strMsg & vbCrLf & colDrives(i) & vbTab & colDrives(i + 1) Next MsgBox strMsg, _ vbInformation + vbOkOnly, _ "CONNECTIONS RESEAU" End If
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 11/06/2004, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/vbs-ipconfig.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.