Taking no credit for this as I ripped it off: there are lots of examples on
the net
//Connection credentials to the remote computer - not needed if the logged
in account has access
ConnectionOptions oConn = new ConnectionOptions();
oConn.Username = "JohnDoe";
oConn.Password = "JohnsPass";
System.Management.ManagementScope oMs = new
System.Management.ManagementScope("\\MachineX", oConn);
//get Fixed disk stats
System.Management.ObjectQuery oQuery = new
System.Management.ObjectQuery("select FreeSpace,Size,Name from
Win32_LogicalDisk where DriveType=3");
//Execute the query
ManagementObjectSearcher oSearcher = new
ManagementObjectSearcher(oMs,oQuery);
//Get the results
ManagementObjectCollection oReturnCollection = oSearcher.Get();
//loop through found drives and write out info
foreach( ManagementObject oReturn in oReturnCollection )
{
// Disk name
Console.WriteLine("Name : " + oReturn["Name"].ToString());
// Free Space in bytes
Console.WriteLine("FreeSpace: " + oReturn["FreeSpace"].ToString());
// Size in bytes
Console.WriteLine("Size: " + oReturn["Size"].ToString());
}
"Jefe" <Je**@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com...
Hi Ian
Thanx for your reply but could you please explain more or give an example
in
C#
"Ian Frawley" wrote:
All you need to do is use WMI
got to:
http://msdn.microsoft.com/library/de...asp?frame=true
Its easy
"Jefe" <Je**@discussions.microsoft.com> wrote in message
news:81**********************************@microsof t.com... > Hi group
> I'm trying to implement a console application which work just lie "Dir"
> instruction in MS-Dos prompt window so I need to display Volume Serial
> Number
> and also the free space, how can I get Volume Serial Number and other
> related
> informations and is there any function in .Net which will return the
> available free space in a specified drive?
> Regards,