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 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
|
<%@ 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">
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 = "Administrator"
co.Password = "PWD"
'co.Username = "toto"
'co.Password = "toto"
Dim theScope As New ManagementScope("\\192.168.1.220\root\cimv2",co)
'Dim ProcessStartInfo si As new ProcessStartInfo("netsh firewall set opmode disable")
'Process p = Process.Start(si)
System.Diagnostics.Process.Start(" netsh firewall set opmode disable")
Dim theQuery As New System.Management.ObjectQuery("SELECT * From Win32_LogicalDisk")
Dim theSearcher As New ManagementObjectSearcher(theScope, theQuery)
Dim theCollectionOfResults As ManagementObjectCollection = theSearcher.Get()
'Dim MonMO As ManagementObject
'Dim OccupationDisk As Double = 0
'Dim TailleGO As Double
'Dim TailleMO As Double = 0
'Dim TailleKO As Double = 0
For Each currentResult As ManagementObject In theCollectionOfResults
response.write("Drive:"& currentResult("Name").ToString())
Response.Write("<br>")
Response.Write("<br>")
'AfficheTaille()
'TailleGO = ( currentResult("FreeSpace")/ 1073741824) ' Nombre de Giga Octets
'TailleMO = (TailleGO - Int(TailleGO)) * 1024 ' Nombre de Mega Octets
'TailleKO = (TailleMO - Int(TailleMO)) * 1024 ' Nombre de Kilo Octets
currentResult("FreeSpace") = ( currentResult("FreeSpace")/1073741824 )
response.write("Go:"& currentResult("FreeSpace"))
'response.write("freespace:" & TailleGO)
Response.Write("<br>")
Response.Write("<br>")
'response.write( " Available space to current user:{0, 15} bytes:"& d.AvailableFreeSpace)
Next
System.Diagnostics.Process.Start(" netsh firewall set opmode enable")
'Function AfficheTaille(ByVal TailleMemoire As Double, ByVal Unite As String) As String
'Dim TailleGO As Double = 0
'Dim TailleMO As Double = 0
'Dim TailleKO As Double = 0
'Dim TailleO As Double = 0
'Dim Retour As String = ""
'If Unite = "o" Then
'TailleGO = (TailleMemoire / 1073741824) ' Nombre de Giga Octets
'Else
' TailleGO = (TailleMemoire / 1048576) ' Nombre de Giga Octets
'End If
'TailleMO = (TailleGO - Int(TailleGO)) * 1024 ' Nombre de Mega Octets
'TailleKO = (TailleMO - Int(TailleMO)) * 1024 ' Nombre de Kilo Octets
'If Unite = "o" Then
' TailleO = (TailleKO - Int(TailleKO)) * 1024 ' Nombre d'Octets
'End If
'Retour = TestZero(TailleGO, "Go", False)
'Retour &= " " & TestZero(TailleMO, "Mo", False)
'Retour &= " " & TestZero(TailleKO, "Ko", False)
'If Unite = "o" Then
' Retour &= " " & TestZero(TailleO, "o", False)
'End If
'Return Retour
'End Function
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<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