Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Performance Counter is the choice if you are wanting it for profiling your application. </p> <p>However, if you want it as a general purpose system info, then you may want to look at WMI. Here is a sample which I used previously for getting disk info:</p> <p><em>Note</em>: You will need a reference to <code>System.Management</code></p> <pre class="lang-vb prettyprint-override"><code>Dim scope As ManagementScope = New ManagementScope("\\.\root\CIMV2") scope.Options.Impersonation = ImpersonationLevel.Impersonate scope.Options.EnablePrivileges = True Dim wmiQuery = "SELECT SystemName, Name, VolumeName, Size, FreeSpace FROM Win32_LogicalDisk WHERE DriveType = 3 " Dim query As ObjectQuery = New ObjectQuery(wmiQuery) Dim searcher As ManagementObjectSearcher = New ManagementObjectSearcher(scope, query) Dim result As New List(Of MyDrive) For Each systemDrive As ManagementObject In searcher.Get Dim diskDrive = New MyDrive diskDrive.SystemName = systemDrive("SystemName").ToString diskDrive.Name = systemDrive("Name").ToString diskDrive.Size = CDec(systemDrive("Size")) / 1073741824 diskDrive.FreeSpace = CDec(systemDrive("FreeSpace")) / 1073741824 diskDrive.VolumeName = systemDrive("VolumeName").ToString result.Add(diskDrive) Next Public Class MyDrive Public Property SystemName As String Public Property Name As String Public Property VolumeName As String Public Property Size As Decimal Public Property FreeSpace As Decimal Public ReadOnly Property PercentFree As Decimal Get Dim percent As Decimal = 0 If Size &gt; 0 Then percent = FreeSpace / Size Return percent End Get End Property End Class </code></pre> <p>Notice that I have divided the disk space to convert it into GB.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload