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

How to make center align child div

 How to make center align child div?   Suppose you have 2 Div tag. And want the make inner tag center <div id="d1">      ...

Ads Inside Post

Powered by Blogger.

Arsip

Blog Archive