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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
<title>Informations sur une machine distante</title>
<HTA:APPLICATION
APPLICATIONNAME="Login Details"
BORDER="thin"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"></head>
<script language="VBScript">
Sub Window_onLoad
Me.ResizeTo 400,300
Me.MoveTo ((Screen.Width / 2) - 200),((Screen.Height / 2) - 150)
End Sub
Sub Default_Buttons
If Window.Event.KeyCode = 13 Then
btn_logindetails.Click
End If
End Sub
Sub Get_Login_Details
strComputer = txt_computer.value
if strComputer = "" Then
msgbox "Nom de machine ou adresse IP invalide",vbOKOnly,"Saisie incorrecte"
Exit Sub
End If
If Ping(strComputer) = False Then
msgbox "L'ordinateur " & strComputer & " ne répond pas.",vbOkOnly, "Machine introuvable"
Exit Sub
End If
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputer = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
Set colComputerIP = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration")
Set colSystemInfo = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem",,48)
For Each objComputer in colComputer
UsrNom = "Aucune session en cours"
If Not IsNull(objComputer.UserName) Then UsrNom = objComputer.UserName
strUserName = "Utilisateur : " & UsrNom
strHostName = "Nom machine : " & objComputer.Name
Next
For Each IPConfig in colComputerIP
If Not IsNull(IPConfig.IPAddress) Then
For intIPCount = LBound(IPConfig.IPAddress) _
to UBound(IPConfig.IPAddress)
strIPAddress = strIPAddress & "Adresse IP : " & IPConfig.IPAddress(intIPCount) & "~"
next
end if
Next
If Right(strIPAddress, 1) = "~" Then
strIPAddress = Left(strIPAddress, Len(strIPAddress) - 1)
End If
strIPAddress = Replace(strIPAddress, "~", vbCrLf)
For Each objItem in colSystemInfo
strOS_Caption = "Système : " & objItem.Caption
strOS_SPVersion = "Version SP : " & objItem.CSDVersion
strOS_VerNumber = "N° Version : " & objItem.Version
Next
MsgBox strUserName & vbcrlf & strHostName & vbcrlf & _
strIPAddress & vbcrlf & strOS_Caption & vbcrlf & _
strOS_SPVersion & vbcrlf & strOS_VerNumber, vbOKOnly, "Informations"
End Sub
Function Ping(strComputer)
Dim objShell, boolCode
Set objShell = CreateObject("WScript.Shell")
boolCode = objShell.Run("Ping -n 1 -w 300 " & strComputer, 0, True)
If boolCode = 0 Then
Ping = True
Else
Ping = False
End If
End Function
</script>
<body STYLE="font:14 pt arial; color:white;filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=1, StartColorStr='#000033', EndColorStr='#0000FF')" onkeypress='vbs:Default_Buttons'>
<table width='80%' height = '100%' align='center' border='0'><tr height='20%'><td></td></tr>
<tr height='10%'><td align='center'>Nom machine ou adresse IP :</td></tr
<tr height='20%'><td align='center'>
<input type="text" value="Saisie" name="txt_computer" maxlength='15' size='16'>
</td></tr><tr height='30%'><td align='center'>
<input type="button" value="Lancer le test" name="btn_logindetails" onClick="Get_Login_Details">
</td></tr><tr height='20%'><td></td></tr></table></body> |
Partager