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 116
|
<%@ Page Language="VB" %>
<%@ Register TagPrefix="wmx" Namespace="Microsoft.Matrix.Framework.Web.UI" Assembly="Microsoft.Matrix.Framework, Version=0.6.0.0, Culture=neutral, PublicKeyToken=6f763c9966660626" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<%@ import Namespace="System.Web.Mail" %>
<%@ import Namespace="System.IO" %>
<%@ import Namespace="System.DirectoryServices" %>
<%@ import Namespace="System.Configuration" %>
<%@ import Namespace="System.Net" %>
<%@ import Namespace="System" %>
<%@ import Namespace="System.Net.DNS" %>
<%@ import Namespace="System.ComponentModel" %>
<%@ import Namespace="System.Management" %>
<%@ import Namespace="System.Runtime.InteropServices" %>
<script runat="server">
' Insert page code here
'
'Displays all computer names in an Active Directory
'Written 08/26/02 - John O'Donnell
Sub Button1_Click(sender As Object, e As EventArgs)
Try
'response.write("Button1_Click")
'lblError.Text = "abc" + 12
' Définition des objets
Dim Ldap As DirectoryEntry = new DirectoryEntry("LDAP://tamac.local", "faratbi", "faratbi")
Dim searcher As DirectorySearcher = New DirectorySearcher (Ldap)
searcher.Filter = "(objectClass=computer)"
Dim DirEntry As DirectoryEntry
' Dim IPHost As IPHostEntry = Dns.Resolve(Dns.GetHostName())
'Dim addressList As IPAddress() = IPHost.AddressList
'mémoire physique totale disponible
'Dim MemoirePhysiqueTotale as UInteger = My.Computer.Info.TotalPhysicalMemory
'Dim a As IPAddress In addressList
'Dim dns As Dns
' Nom de la machine
'Dim NomMachine As String = Dns.GetHostName
' Récupération de la liste des IP de la machine
'Dim InfoIps As IPHostEntry = Dns.GetHostEntry(NomMachine)
'Dim MesIp As IPAddress() = InfoIps.AddressList
For Each result As SearchResult In searcher.FindAll
'Dim IPHost As IPHostEntry = Dns.Resolve(DirEntry.Properties("Name"))
'Dim IPHost As IPHostEntry = Dns.Resolve(Dns.GetHostName())
' On récupère l'entrée trouvée lors de la recherche
DirEntry = result.GetDirectoryEntry
'Response.Write(DirEntry.)
'On peut maintenant afficher les informations désirées
'response.write("Login : " + DirEntry.Properties("SAMAccountName").Value)
'Nom des machines
Response.Write("Nom : " + DirEntry.Properties("Name").value)
'IP
'Dim IPHost As IPHostEntry = DirEntry.Properties("Name")
Dim IPHost As IPHostEntry = Dns.Resolve(DirEntry.Properties("Name").value)
Dim addressList As IPAddress() = IPHost.AddressList
Dim a As IPAddress = addressList(0) ' récupère la première adresse
Response.Write("IP : " + a.ToString())
Response.write("Os_version : " + DirEntry.Properties("operatingSystemVersion").value)
Response.write("Os : " + DirEntry.Properties("operatingSystem").value)
Response.write("lastLogoff :" +DirEntry.Properties("lastLogon").value)
'récupération des infos systèmes (mémoire physique disponible)
'Dim MemoirePhysiqueDisponible as UInteger = new GetSystemInfo(DirEntry.Properties("Name").value)
'Response.write("Mémoire_physique_dispo : "+ DirEntry.properties("Name").value)
'Response.Write("IP : " + DirEntry.Properties("displayName").value)
'mémoire physique totale disponible
'response.write("Email : " + DirEntry.Properties("mail").Value)
'response.write("Tél : " + DirEntry.Properties("TelephoneNumber").Value)
'response.write("Password : " + DirEntry.Properties("password").Value)
'response.write("Ip : {0}", CurrentIp.ToString)
Next
Catch Ex As Exception
'lblError.Text =Ex.tostring
response.write(Ex.tostring)
End Try
'End Sub
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Lister"></asp:Button>
<!-- Insert content here -->
</form>
</body>
</html> |
Partager