1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
ComputerName=InputBox ("Nom de l'ordinateur à tester où rien pour celui-ci : ","IpConfig")
On error resume next
set IPConfigSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//" & ComputerName).ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=TRUE")
If Err.Number<>0 Then
wscript.echo " - non accessible -"
Else
for each IPConfig in IPConfigSet
BailObtenu = IPConfig.DHCPLeaseObtained
BailExpirant = IPConfig.DHCPLeaseExpires
'---- Convertion des date et heure d'obtention et d'expiration des baux DHCP en un format lisible par l'utilisateur. ----
BailObtenu = mid(BailObtenu, 7, 2) & "/" & mid(BailObtenu, 5, 2) & "/" & mid(BailObtenu, 1, 4) & " - " & mid(BailObtenu, 9, 2)& ":" & mid(BailObtenu, 11, 2)& ":" & mid(BailObtenu, 13, 2)
BailExpirant = mid(BailExpirant, 7, 2) & "/" & mid(BailExpirant, 5, 2) & "/" & mid(BailExpirant, 1, 4) & " - " & mid(BailExpirant, 9, 2)& ":" & mid(BailExpirant, 11, 2)& ":" & mid(BailExpirant, 13, 2)
MsgBox " Configuration réseau de l'ordinateur " & ComputerName & vbcrlf & vbcrlf & _
" Nom Machine " & vbtab & " : " & IPConfig.DNSHostName & vbcrlf & vbcrlf & _
" Carte " & vbtab & vbtab & " : " & IPConfig.Description & vbcrlf & _
" adresse MAC " & vbtab & " : " & IPConfig.MACAddress & vbcrlf & _
" DHCP Activé" & vbtab & " : " & IPConfig.DHCPEnabled & vbcrlf & _
" adresse IP " & vbtab & " : " & IPConfig.IPAddress(0) & vbcrlf & _
" Masque " & vbtab & vbtab & " : " & IPConfig.IPSubnet(0) & vbcrlf & _
" passerelle " & vbtab & " : " & IPConfig.DefaultIPGateway(0) & vbcrlf & _
" Serveur DHCP " & vbtab & " : " & IPConfig.DHCPServer & vbcrlf & vbcrlf & _
" Serveur DNS " & vbtab & " : " & IPConfig.DNSServerSearchOrder(0) & vbcrlf & _
" " & vbtab & vbtab & " : " & IPConfig.DNSServerSearchOrder(1) & vbcrlf & _
" Serveur WINS " & vbtab & " : " & IPConfig.WINSPrimaryServer(0) & vbcrlf & _
" " & vbtab & vbtab & " : " & IPConfig.WINSSecondaryServer(0) & vbcrlf & vbcrlf & _
" Bail obtenu " & vbtab & " : " & BailObtenu & vbcrlf & _
" Bail expirant " & vbtab & " : " & BailExpirant _
,,"Configuration "
Next
End If |
Partager