CSharp examples for Operating System:Hard Drive
Get Hard Drive Id
using System.Management; using System;// w w w . j av a 2s . c om public class Main{ public static string GetHardDriveId() { var drive = "C"; var dsk = new ManagementObject( @"win32_logicaldisk.deviceid=""" + drive + @":"""); dsk.Get(); return dsk["VolumeSerialNumber"].ToString(); } }