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 100 101 102 103 104 105 106 107 108 109 110 111
| <title>Informations sur un ordinateur distant</title>
<HTA:APPLICATION
APPLICATIONNAME="Login Details"
BORDER="thin"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"></head>
<script language="VBScript">
Public strComputer
Dim WSHShell
On error resume next
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,"Réessayez !"
Exit Sub
End If
If Ping(strComputer) = False Then
msgbox "L'ordinateur " & strComputer & " ne répond pas.",vbOkOnly, "Ordinateur introuvable."
Exit Sub
End If
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
if Err.Number <> 0 Then MsgBox "Vérifier que vous disposez des droits d'admin", VbOKOnly,"Erreur droits insuffisants" : Exit Sub
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 = "Aucun"
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
Set WSHShell = CreateObject("WScript.Shell")
reboot = Msgbox(strUserName & vbcrlf & strHostName & vbcrlf & strIPAddress & vbcrlf & strOS_Caption & vbcrlf & strOS_SPVersion & vbcrlf & strOS_VerNumber& vbcrlf& VbCrLf & VbCrLf & "Voulez-vous redémarrer le poste ?", vbYesNo, "Informations")
if reboot = 6 then
WSHShell.Run ("C:\WINDOWS\system32\shutdown.exe -m \\" & strComputer & " -r -f -t 0")
Set oSh = CreateObject("WScript.Shell")
Set oExec = oSh.Exec ("WScript popup.vbs " & strComputer)
Do While Ping(strComputer) = True
Loop
Do While Ping(strComputer) = False
Loop
oExec.Terminate
MsgBox "Le poste " & strComputer & " a redémarré.", VbOKOnly,"Poste redémarré"
Exit Sub
End if
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="" 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