For smart Primates & ROBOTS (oh and ALIENS ).

Blogroll

Thursday, March 12, 2015

Get Volume Serial Number of Drive in C#

Listed below the code use in your project to get Volume serial number

//let's show C drive's volume serial number
String d = "c";
try {
    System.Management.ManagementObject dsk1 = new System.Management.ManagementObject(@"win32_logicaldisk.deviceid=""" + d + @":""");
    dsk1.Get();
    string s1 = dsk1["VolumeSerialNumber"].ToString();
    MessageBox.Show(s1);
}
catch (Exception ee)
{
    MessageBox.Show(ee.ToString());

}
Share:

0 comments:

Post a Comment

Unable to resolve <website url> Try checking the for validity Google Pagespeed Insights

Unable to resolve <website url> Try checking the for validity Google Pagespeed Insights   You have a website and want to test it'...

Ads Inside Post

Powered by Blogger.

Arsip

Blog Archive