Hey guys,
I'm looking for a way to obtain an SSD serial number and I'm not interested in the volume serial number.
Thanks in advance,
Jeff
As suggested, Win32/WMI is the natural first stop, but WMI/WMIC/Win32_PhysicalMedia often does not surface the manufacturer serial for many SSDs (NVMe devices in particular) or for drives behind USB/SATA bridges — the OS (or bridge) can return a controller/bridge identifier instead. ’s “doesn’t work for SSD” is a common symptom. [WD/SanDisk notes on WMIC and NVMe behavior].(https://support-en.sandisk.com/app/answers/detailweb/a_id/21600/~/find-the-wd-product-code-and-serial-number-with-a-windows-or-macos-computer)
For a robust programmatic approach on Windows use DeviceIoControl + IOCTL_STORAGE_QUERY_PROPERTY to fetch a STORAGE_DEVICE_DESCRIPTOR and read its SerialNumberOffset; that will return the device serial when the driver exposes it. For NVMe devices you should query the NVMe identify data (the controller/namespace identify structures) via the storage protocol IOCTLs (these contain the controller SN fields). If the basic device-descriptor query returns no serial, fall back to SCSI VPD (page 0x83), ATA IDENTIFY (for SATA/ATA), or NVMe Identify as appropriate. See Microsoft docs on STORAGE_DEVICE_DESCRIPTOR and NVMe identify/IOCTL handling.
STORAGE_DEVICE_DESCRIPTOR (ms docs) Working with NVMe on Windows / NVMe identify info
Practical tips and quick checks: confirm the bus type (NVMe vs SATA vs USB) first — a USB enclosure commonly hides the internal SSD serial. Use vendor utilities or smartmontools’ smartctl (which issues ATA or NVMe identify commands) to confirm the drive reports a serial outside your code path. PowerShell can be useful but watch out: for NVMe Get-PhysicalDisk may return NGUID/EUI in SerialNumber; the controller serial often appears in AdapterSerialNumber. Example quick PowerShell check:
Get-PhysicalDisk | Select DeviceId,FriendlyName,SerialNumber,AdapterSerialNumber For tools that reliably show the hardware serial try smartctl (smartmontools) or the drive vendor’s utility. smartctl manual Dell KB on PowerShell/NVMe serials
If programmatic queries still return nothing, enumerate the fallback order in code: device descriptor -> device id (VPD/ATA identify) -> NVMe identify/pass-through -> vendor tool. That usually isolates where the serial is being lost (driver, bridge, or firmware).
Jump to Post— Clinton Portis 211Depends on ye' operating system. If windows OS, you can use the <windows.h> library to populate attributes of the Win32_DiskDrive Class:
http://msdn.microsoft.com/en-us/library/aa394132%28v=VS.85%29.aspx
I believe the specific attribute ye' are looking for …
Depends on ye' operating system. If windows OS, you can use the <windows.h> library to populate attributes of the Win32_DiskDrive Class:
http://msdn.microsoft.com/en-us/library/aa394132%28v=VS.85%29.aspx
I believe the specific attribute ye' are looking for is string SerialNumber;
SerialNumber
Data type: string
Access type: Read-onlyNumber allocated by the manufacturer to identify the physical media.
Example: WD-WM3493798728
Windows Server 2003, Windows XP, Windows 2000, and Windows NT 4.0: This property is not available.
There doesn't appear to be an attribute specifically for a SSD serial, and there doesn't appear to be a Win32_SolidStateDrive Class.. not sure how windows would handle this situation. It might display all parts of the serial together, in which case you can of course parse the desired info from the string.
for a solid state drive this doesnt work tho
According to this link, it's possible the info ye' require might actually reside in the Win32_PhysicalMedia class:
class Win32_PhysicalMedia : CIM_PhysicalMedia
{
string Caption;
string Description;
datetime InstallDate;
string Name;
string Status;
string CreationClassName;
string Manufacturer;
string Model;
string SKU;
string SerialNumber = NULL;
string Tag = NULL;
string Version;
string PartNumber;
string OtherIdentifyingInfo;
boolean PoweredOn;
boolean Removable;
boolean Replaceable;
boolean HotSwappable;
uint64 Capacity;
uint16 MediaType;
string MediaDescription;
boolean WriteProtectOn;
boolean CleanerMedia;
}; We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.