Você pode fazer isso de maneira nativa no Windows, usando o Interface de linha de comando (WMIC) da Instrumentação de gerenciamento do Windows. Nesse caso, o comando desejado é wmic diskdrive
, que retorna o Win32_DiskDrive
class . Você pode executá-lo a partir do CMD ou do PowerShell.
Do sistema do qual estou escrevendo, por exemplo:
PS C:\WINDOWS\system32> wmic diskdrive
Availability BytesPerSector Capabilities CapabilityDescriptions Caption CompressionMethod ConfigManagerErrorCode ConfigManagerUserConfig CreationClassName DefaultBlockSize Description DeviceID ErrorCleared ErrorDescription ErrorMethodology FirmwareRevision Index InstallDate InterfaceType LastErrorCode Manufacturer MaxBlockSize MaxMediaSize MediaLoaded MediaType MinBlockSize Model Name NeedsCleaning NumberOfMediaSupported Partitions PNPDeviceID PowerManagementCapabilities PowerManagementSupported SCSIBus SCSILogicalUnit SCSIPort SCSITargetId SectorsPerTrack SerialNumber Signature Size Status StatusInfo SystemCreationClassName SystemName TotalCylinders TotalHeads TotalSectors TotalTracks TracksPerCylinder
512 {3, 4} {"Random Access", "Supports Writing"} Adaptec Array SCSI Disk Device 0 FALSE Win32_DiskDrive Disk drive \.\PHYSICALDRIVE0 V1.0 0 SCSI (Standard disk drives) TRUE Fixed hard disk media Adaptec Array SCSI Disk Device \.\PHYSICALDRIVE0 1 SCSI\DISK&VEN_ADAPTEC&PROD_ARRAY&9D7B342&0&040000 4 0 0 0 63 ######## 3000179105280 OK Win32_ComputerSystem ######## 364751 255 5859724815 93011505 255
512 {3, 4} {"Random Access", "Supports Writing"} Seagate Desktop USB Device 0 FALSE Win32_DiskDrive Disk drive \.\PHYSICALDRIVE6 0130 6 USB (Standard disk drives) TRUE External hard disk media Seagate Desktop USB Device \.\PHYSICALDRIVE6 1 USBSTOR\DISK&VEN_SEAGATE&PROD_DESKTOP&REV_0130\########____&0 0 0 0 0 63 ######## 1951563079 2000396321280 OK Win32_ComputerSystem ######## 243201 255 3907024065 62016255 255
512 {3, 4, 10} {"Random Access", "Supports Writing", "SMART Notification"} SAMSUNG HD753LJ SCSI Disk Device 0 FALSE Win32_DiskDrive Disk drive \.\PHYSICALDRIVE3 1AA0 3 SCSI (Standard disk drives) TRUE Fixed hard disk media SAMSUNG HD753LJ SCSI Disk Device \.\PHYSICALDRIVE3 1 SCSI\DISK&VEN_SAMSUNG&PROD_HD753LJ&BE9218C&0&000000 0 0 5 0 63 ############## 750153761280 OK Win32_ComputerSystem ######## 91201 255 1465144065 23256255 255
512 {3, 4, 10} {"Random Access", "Supports Writing", "SMART Notification"} INTEL SS DSC2CT120A3 SCSI Disk Device 0 FALSE Win32_DiskDrive Disk drive \.\PHYSICALDRIVE1 300i 1 SCSI (Standard disk drives) TRUE Fixed hard disk media INTEL SS DSC2CT120A3 SCSI Disk Device \.\PHYSICALDRIVE1 3 SCSI\DISK&VEN_INTEL_SS&PROD_DSC2CT120A3&1EA2D231&0&000000 0 0 4 0 63 ################## 2085025849 120031027200 OK Win32_ComputerSystem ######## 15505 240 234435600 3721200 240
4096 {3, 4} {"Random Access", "Supports Writing"} WD My Book 1140 USB Device 0 FALSE Win32_DiskDrive Disk drive \.\PHYSICALDRIVE7 1019 7 USB (Standard disk drives) TRUE External hard disk media WD My Book 1140 USB Device \.\PHYSICALDRIVE7 1 USBSTOR\DISK&VEN_WD&PROD_MY_BOOK_1140&REV_10194C313332314C41473457425348&0 0 0 0 0 63 ############## 3796332454 4000710389760 OK Win32_ComputerSystem ######## 60799 255 976735935 15503745 255
512 {3, 4, 10} {"Random Access", "Supports Writing", "SMART Notification"} SAMSUNG HD753LJ SCSI Disk Device 0 FALSE Win32_DiskDrive Disk drive \.\PHYSICALDRIVE2 1AA0 2 SCSI (Standard disk drives) TRUE Fixed hard disk media SAMSUNG HD753LJ SCSI Disk Device \.\PHYSICALDRIVE2 1 SCSI\DISK&VEN_SAMSUNG&PROD_HD753LJ&1EA2D231&0&010100 1 0 4 1 63 ############## 750153761280 OK Win32_ComputerSystem ######## 91201 255 1465144065 23256255 255
4096 {3, 4} {"Random Access", "Supports Writing"} WD My Book 1140 USB Device 0 FALSE Win32_DiskDrive Disk drive \.\PHYSICALDRIVE8 1016 8 USB (Standard disk drives) TRUE External hard disk media WD My Book 1140 USB Device \.\PHYSICALDRIVE8 1 USBSTOR\DISK&VEN_WD&PROD_MY_BOOK_1140&REV_10164C313332314C41473347365348&0 0 0 0 0 63 ############## 3679187067 4000710389760 OK Win32_ComputerSystem ######## 60799 255 976735935 15503745 255
512 {3, 4} {"Random Access", "Supports Writing"} WD 10EACS External USB Device 0 FALSE Win32_DiskDrive Disk drive \.\PHYSICALDRIVE5 1.65 5 USB (Standard disk drives) TRUE External hard disk media WD 10EACS External USB Device \.\PHYSICALDRIVE5 0 USBSTOR\DISK&VEN_WD&PROD_10EACS_EXTERNAL&REV_1.65442D574341553430373030383036&0 0 0 0 0 63 ############### 0 1000202273280 OK Win32_ComputerSystem ######## 121601 255 1953520065 31008255 255
512 {3, 4, 10} {"Random Access", "Supports Writing", "SMART Notification"} Crucial_ CT512MX100SS SCSI Disk Device 0 FALSE Win32_DiskDrive Disk drive \.\PHYSICALDRIVE4 MU01 4 SCSI (Standard disk drives) TRUE Fixed hard disk media Crucial_ CT512MX100SS SCSI Disk Device \.\PHYSICALDRIVE4 1 SCSI\DISK&VEN_CRUCIAL_&PROD_CT512MX100SS&BE9218C&0&010100 1 0 5 1 63 ############ 512105932800 OK Win32_ComputerSystem ######## 62260 255 1000206900 15876300 255
(eu editei os números de série e o nome do sistema com ########
.)
Como você provavelmente já notou, o tamanho da linha é longo, então você vai querer ser seletivo sobre as propriedades que você retornou, ter a saída em uma propriedade por linha ( wmic diskdrive list /format:list
), canalizar a saída para um arquivo, e / ou definir a largura do seu console para ser muito grande antes de executar o comando, porque será basicamente ilegível se quebra de linha entra em ação.