Click to See Complete Forum and Search --> : get the hard-drive serial number
dky1e
May 29th, 2002, 04:16 PM
Does anyone know how to retrieve the hard-drive serial number?
I tried System.Management documentation to no help.
Any idea on how can I get at it? Any useful links? I would prefer to implement it in c#, but c++ or vb would also suffice.
Thank you for you help!
kd.
armtusk
May 30th, 2002, 11:58 PM
Look into .NET & WMI documentation for more details....
I adapted the below code from a sample given in the .NET documentation.
using System;
using System.Management;
class VolumeSerialFinder
{
public static int Main(string[] args)
{
ManagementClass diskClass = new ManagementClass("Win32_LogicalDisk");
ManagementObjectCollection disks = diskClass.GetInstances();
foreach (ManagementObject disk in disks)
{
Console.WriteLine("Disk = " + disk["VolumeSerialNumber"]);
}
Console.ReadLine();
return 0;
}
}
dky1e
May 31st, 2002, 10:48 AM
ohh... beautiful!!!
Thank you so much!
I don't believe I couldn't find it through the msdn mess :)
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.