Reputation:
I would like to get the drive serial number where the AppData folder is located.
I use this code: SELECT SerialNumber FROM Win32_DiskDrive
.
But this returns every serial number (USB, all drive etc.).
How can I only get the drive where the AppData folder is located?
Upvotes: 0
Views: 476
Reputation: 9710
Assume you are talking about serial number of physical disk drive. One way to achieve this as below you can refer to:
PathGetDriveNumber
. For example, get C:
from AppData
path.Win32_DiskDriveToDiskPartition
and Win32_LogicalDiskToPartition
.As snapshots above show, you can get C:
associated with PHYSICALDRIVE0
.
Win32_DiskDrive
.Upvotes: 0