Get SerialNumber Disk Driver
-
Hi all I am bulding application web. I have problem with Licenes key I check key by SerialNumber Disk Driver on Server. HardDrive hd = null; ManagementObjectSearcher searcher; ArrayList hdCollection = new ArrayList(); searcher = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive"); foreach (ManagementObject wmi_HD in searcher.Get()) { hd = new HardDrive(); hd.Model = wmi_HD["Model"].ToString(); hd.Type = wmi_HD["InterfaceType"].ToString(); if (wmi_HD["SerialNumber"] == null) hd.SerialNo = "None"; else hd.SerialNo = wmi_HD["SerialNumber"].ToString(); hdCollection.Add(hd); } But have problem when i insert usb, the system get SerialNo of USB. How can i get only SerialNo HDD on Computer.
-
Hi all I am bulding application web. I have problem with Licenes key I check key by SerialNumber Disk Driver on Server. HardDrive hd = null; ManagementObjectSearcher searcher; ArrayList hdCollection = new ArrayList(); searcher = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive"); foreach (ManagementObject wmi_HD in searcher.Get()) { hd = new HardDrive(); hd.Model = wmi_HD["Model"].ToString(); hd.Type = wmi_HD["InterfaceType"].ToString(); if (wmi_HD["SerialNumber"] == null) hd.SerialNo = "None"; else hd.SerialNo = wmi_HD["SerialNumber"].ToString(); hdCollection.Add(hd); } But have problem when i insert usb, the system get SerialNo of USB. How can i get only SerialNo HDD on Computer.
You can check if the drive letter is a fixed drive, there's a way to get an array of DriveInfo objects that will tell you that.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Hi all I am bulding application web. I have problem with Licenes key I check key by SerialNumber Disk Driver on Server. HardDrive hd = null; ManagementObjectSearcher searcher; ArrayList hdCollection = new ArrayList(); searcher = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive"); foreach (ManagementObject wmi_HD in searcher.Get()) { hd = new HardDrive(); hd.Model = wmi_HD["Model"].ToString(); hd.Type = wmi_HD["InterfaceType"].ToString(); if (wmi_HD["SerialNumber"] == null) hd.SerialNo = "None"; else hd.SerialNo = wmi_HD["SerialNumber"].ToString(); hdCollection.Add(hd); } But have problem when i insert usb, the system get SerialNo of USB. How can i get only SerialNo HDD on Computer.
Just to add, this s a C# question that has nothing to do with ASP.NET, why did you post it here ?
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Just to add, this s a C# question that has nothing to do with ASP.NET, why did you post it here ?
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Thanks Reply my app is asp.net check LicenesKey With DriveInfo i dont get SerialNumber HDD disk !!!!
OK, well, that's reasonable. It's still not an ASP.NET question, tho. No, with DriveInfo you can check if the drive you're looking at is removable. Does your other code not give you the drive letter you're looking at so you can match the two ?
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )