상세 컨텐츠

본문 제목

HDD Serial

C#

by 탑~! 2009. 5. 25. 18:58

본문

        public string GetHDDSerialNumber(string drive)
        {
            //check to see if the user provided a drive letter
            //if not default it to "C"
            if (drive == "" || drive == null)
            {
                drive = "C";
            }
            //create our ManagementObject, passing it the drive letter to the
            //DevideID using WQL
            System.Management.ManagementObject disk = new System.Management.ManagementObject("win32_logicaldisk.deviceid=\"" + drive + ":\"");
            //bind our management object
            disk.Get();
            //return the serial number
            return disk["VolumeSerialNumber"].ToString();
        }

'C#' 카테고리의 다른 글

Visual C#.NET을 사용하여 XML 파일에 특수 문자 사용  (0) 2009.08.12
MAC Address  (0) 2009.05.25
CPU Serial  (0) 2009.05.25
DataSet 압축  (0) 2009.04.03
SQL Injection  (0) 2009.04.03

관련글 더보기