ㆍ언어대상 : C# ㆍ작성자 : 김영재
foreach(ManagementObject drive in new ManagementObjectSearcher("select * from Win32_DiskDrive where InterfaceType='USB'").Get())
{
// associate physical disks with partitions
foreach(ManagementObject partition in new ManagementObjectSearcher("ASSOCIATORS OF {Win32_DiskDrive.DeviceID='" + drive["DeviceID"] + "'} WHERE AssocClass = Win32_DiskDriveToDiskPartition").Get())
{
// Console.WriteLine("Partition=" + partition["Name"]);
richTextBoxEx1.AppendLine( "Partition=" + partition["Name"] + "--------");
// associate partitions with logical disks (drive letter volumes)
foreach(ManagementObject disk in new ManagementObjectSearcher("ASSOCIATORS OF {Win32_DiskPartition.DeviceID='"+ partition["DeviceID"] + "'} WHERE AssocClass = Win32_LogicalDiskToPartition").Get())
{
//Console.WriteLine("Disk=" + disk["Name"]);
textBox2.Text = "Disk=" + disk["Name"];
}
}
// this may display nothing if the physical disk
// does not have a hardware serial number
//Console.WriteLine("Serial=" + new ManagementObject("Win32_PhysicalMedia.Tag='" + drive["DeviceID"] + "'")["SerialNumber"]);
textBox3.Text = "Serial=" + new ManagementObject("Win32_PhysicalMedia.Tag='" + drive["DeviceID"] + "'")["SerialNumber"];
}
{
// associate physical disks with partitions
foreach(ManagementObject partition in new ManagementObjectSearcher("ASSOCIATORS OF {Win32_DiskDrive.DeviceID='" + drive["DeviceID"] + "'} WHERE AssocClass = Win32_DiskDriveToDiskPartition").Get())
{
// Console.WriteLine("Partition=" + partition["Name"]);
richTextBoxEx1.AppendLine( "Partition=" + partition["Name"] + "--------");
// associate partitions with logical disks (drive letter volumes)
foreach(ManagementObject disk in new ManagementObjectSearcher("ASSOCIATORS OF {Win32_DiskPartition.DeviceID='"+ partition["DeviceID"] + "'} WHERE AssocClass = Win32_LogicalDiskToPartition").Get())
{
//Console.WriteLine("Disk=" + disk["Name"]);
textBox2.Text = "Disk=" + disk["Name"];
}
}
// this may display nothing if the physical disk
// does not have a hardware serial number
//Console.WriteLine("Serial=" + new ManagementObject("Win32_PhysicalMedia.Tag='" + drive["DeviceID"] + "'")["SerialNumber"]);
textBox3.Text = "Serial=" + new ManagementObject("Win32_PhysicalMedia.Tag='" + drive["DeviceID"] + "'")["SerialNumber"];
}
해당 내용은 (주)데브존의 웹봇이 자동으로 저희 홈페이지와 API로 동기화한 내용입니다. 자세한 내용은 홈페이지 http://www.devzone.co.kr 또는 모바일 폰에서 http://devzone.co.kr을 접속 하여 확인해 보시기 비랍니다.
- 대표 전화 : 02) 2061 - 0753 - Fax : 02) 2061 - 0759 - Skype : devzone24
- 주소 : 서울특별시 양천구 목1동 923-14. 현대드림타워 1024호
- 기술 문의: 02) 2061-1259 김민석 기술이사
- 대표 전화 : 02) 2061 - 0753 - Fax : 02) 2061 - 0759 - Skype : devzone24
- 주소 : 서울특별시 양천구 목1동 923-14. 현대드림타워 1024호
- 기술 문의: 02) 2061-1259 김민석 기술이사
댓글 없음:
댓글 쓰기