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 112 113 114 115
| <title>CACHLAB - Informations sur un ordinateur distant - @DEVELOPPEZ.NET</title>
<HTA:APPLICATION
APPLICATIONNAME="Login Details"
BORDER="thin"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"></head>
<script language="VBScript">
Public strComputer
Dim WSHShell
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
On error resume next
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
On error goto 0
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)
Set colItems = objWMIService.ExecQuery("Select * from Win32_BaseBoard")
Set colProc = objWMIService.ExecQuery("Select * from Win32_Processor")
Set colBIOS = objWMIService.ExecQuery("Select * from Win32_BIOS")
For Each objItem in colItems
Marque = objItem.Manufacturer
Next
For Each objComputer in colComputer
UsrNom = "Aucun"
If Not IsNull(objComputer.UserName) Then UsrNom = objComputer.UserName
strUserName = "Utilisateur : " & UsrNom
strHostName = "Nom machine : " & objComputer.Name
Model = Marque & " " & objComputer.Model
Memoire = "Mémoire: " & ROUND (objComputer.TotalPhysicalMemory / 1024 / 1024 /1024) & " Go"
NbrProc = objComputer.NumberOfProcessors
Next
For Each objProc in colProc
Processeur = NbrProc & " " & objProc.Name & " à " & objProc.CurrentClockSpeed & " Mhz"
Next
For each objBIOS in colBIOS
Serial = "N° série: " & objBIOS.SerialNumber
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) & "~"
mac = "Adresse Mac: " & IPConfig.MACAddress
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")
MsgBox strHostName & vbcrlf & vbcrlf & strUserName & vbcrlf & strIPAddress & vbCrLf & mac & vbCrLf & vbCrLf & Model & vbCrLf & Processeur & vbCrLf & Memoire & vbcrlf & Serial & vbCrLf & vbcrlf & strOS_Caption & vbcrlf & strOS_SPVersion & vbcrlf & strOS_VerNumber & VbCrLf, 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="" 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