How can I get the correct NVMe serial number using PowerShell?

0
88
Asked By CuriousCoder01 On

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

Answered By ScriptMaster On

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!

Answered By CIM_Explorer On

Have you tried using CIM? It might give you a more reliable output for the serial number you're looking for. Just a thought!

Answered By DellGuru On

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.

Answered By TechSavvyGuy42 On

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.

HardcoreHacker33 -

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

Answered By TechieNerd On

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.

Answered By DataSeeker On

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.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.