PC Review


Reply
Thread Tools Rate Thread

Detecting total and free disk/memory space

 
 
RobinSword
Guest
Posts: n/a
 
      28th Feb 2005
Hi there!

I want my VB.NET-program to detect the total and used amount of disk
space and memory of the system. How can I do that?
I know there is WMI, but I don't know which SELECT-Statement I have to
build in order to get these information.

Best regards
RobinSword


Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
 
Reply With Quote
 
 
 
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      28th Feb 2005
Robin,

"RobinSword" <(E-Mail Removed)> schrieb:
> I want my VB.NET-program to detect the total and used amount of disk
> space and memory of the system. How can I do that?
> I know there is WMI, but I don't know which SELECT-Statement I have to
> build in order to get these information.


Add a reference to "System.Management.dll".

\\\
Imports System.Management
..
..
..
Dim disk As New ManagementObject("Win32_LogicalDisk.DeviceID=""C:""")
Dim p As PropertyData
For Each p In disk.Properties
Console.WriteLine("{0} = {1}", p.Name, p.Value)
Next p
///

<URL:http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=842&lngWId=10>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

 
Reply With Quote
 
Brian Swanson
Guest
Posts: n/a
 
      28th Feb 2005
This is probably a cheating way to accomplish this but here's how I've
done it in the past:

FileSys = CreateObject("Scripting.FileSystemObject")
Try
Drv = FileSys.GetDrive("C:")

Dim lAvailableSpace As Long
lAvailableSpace = Drv.AvailableSpace

Dim lTotalSpace As Long
lTotalSpace = Drv.TotalSize
Finally
Drv = Nothing
End Try

Hope this helps,
Brian Swanson

"RobinSword" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed):
> Hi there!
>
> I want my VB.NET-program to detect the total and used amount of disk
> space and memory of the system. How can I do that?
> I know there is WMI, but I don't know which SELECT-Statement I have to
> build in order to get these information.
>
> Best regards
> RobinSword
>
>
> Posted Via Usenet.com Premium Usenet Newsgroup Services
> ----------------------------------------------------------
> ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
> ----------------------------------------------------------
> http://www.usenet.com


 
Reply With Quote
 
RobinSword
Guest
Posts: n/a
 
      1st Mar 2005
Thanks, I now use the WMI-method of Herfried K. Wagner.
Is there somewhere a list available of all WM-Tables and -Properties
one can query? I desperately search for such a list!!

I also want to know the amount of free system-RAM. Any idea?


Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: No free disk space error even though there is enough disk space on Windows Vista x64 Rick Rogers Windows Vista Installation 0 6th Aug 2009 11:34 AM
Free disk space and total disk space UJ Microsoft C# .NET 3 6th Apr 2006 09:44 PM
How do I free up disk space or insuffient virtual memory =?Utf-8?B?amZsYW5kcnk=?= Microsoft Word Document Management 0 10th Feb 2005 10:23 PM
CPU utilization, Memory Available and Disk Free Space Collection =?Utf-8?B?QWxhbiBUYW5n?= Microsoft Windows 2000 CMD Promt 1 13th Oct 2004 12:12 PM
Get Total disk space free/used?! Lars Siden Microsoft Dot NET Framework 1 7th Dec 2003 10:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:48 AM.