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
|
<%@ 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" %>
<%@ import Namespace="System" %>
<%@ import Namespace="ActiveDs" %>
<%@ import Namespace="System.Management.ConnectionOptions" %>
<%@ import Namespace="System.Diagnostics.Process" %>
<script runat="server">
' Insert page code here
'
Sub Button1_Click(sender As Object, e As EventArgs)
Dim co As ConnectionOptions = New ConnectionOptions()
With co
.Impersonation = System.Management.ImpersonationLevel.Impersonate
'* Use next line for XP
.Authentication = System.Management.AuthenticationLevel.Packet
'* Use next line for Win prior XP
'.Authentication = System.Management.AuthenticationLevel.Connect
End With
co.Username = "toto"
co.Password = "toto"
Dim theScope As New ManagementScope("\\192.168.1.120\root\cimv2",co)
Dim theQuery As New System.Management.ObjectQuery("SELECT * From Win32_OperatingSystem")
Dim theSearcher As New ManagementObjectSearcher(theScope, theQuery)
Dim theCollectionOfResults As ManagementObjectCollection = theSearcher.Get()
For Each currentResult As ManagementObject In theCollectionOfResults
response.write("Drive:"& currentResult("LastBootUpTime").ToString())
Response.Write("<br>")
Response.Write("<br>")
Next
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
<asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Button"></asp:Button>
</p>
<!-- Insert content here -->
</form>
</body>
</html> |
Partager