I'm really struggling with getting the correct NVMe serial number using PowerShell. In my script, I'm using the command `(Get-PhysicalDisk).AdapterSerialNumber`, but it's not working as expected. The `SerialNumber` returns a value like `E823_8FA6_BF53_0001_001B_448B_4BAB_1EF4`, which is incorrect on some of my Dell machines. The problem is that on certain devices, the `AdapterSerialNumber` is blank instead. I've noticed that tools like CrystalDiskInfo can access the serial number without issue, so I believe there's a solid method to retrieve it programmatically without needing to install extra software on each machine. Additionally, Intel's Optane Memory and Storage Management shows the serial number correctly in the Controller Serial Number field, but the Intel MAS CLI tool isn't available for download due to website issues. To troubleshoot, I've already tried switching from RAID to AHCI, but that hasn't helped either. Any advice on how to proceed?
6 Answers
Consider checking out this [get-subnqn.ps1 script](https://github.com/ken-yossy/nvmetool-win-powershell/blob/main/scripts/get-subnqn.ps1). It returns the same serial number as CrystalDiskInfo for the NVMe disks I've tested. You could tweak it for your specific needs!
Have you tried using CIM? It might give you a more reliable output for the serial number you're looking for. Just a thought!
The command you’re using actually works on my Precision 3581. Just curious, what models are you testing this on? Maybe it’s model-specific.
You might want to check the FruID; it seems to correspond with `AdapterSerialNumber` on my setup, which has a mix of NVMe and SATA SSDs. If it’s blank, try using some other methods to pull the info. Could be a model-specific issue you're experiencing.
The reason you're having issues is that M.2 drives have their own built-in controllers, which might complicate how they report serial numbers in PowerShell. That's likely why you're seeing discrepancies.
I recommend outputting all the information from `Get-PhysicalDisk` to see what details you can extract. It might help you figure out the right command to use.

+1, I've seen the same thing work on my machines (HP and MSI NVMe)!