0

Went through few similar queries, but could not a get a related solution as per my requirement.

Here is what I want:

I am writing a powershell script that, given a logical drive name (or a filepath), should be able to return me its underlying physical drive info like serial number, manufacturer etc.

I can get these details from Get-Disk or Get-PhysicalDisk. I see logical volume details from Get-Volume. But how do I correlate these two results to filter out results based on a specific logical volume or path (like get serial number of physical disk for the logical drive D:)

Any help is appreciated.

This is what I have tried until now:

My logical driver for which I want to get disk details:

PS C:\Users\Administrator> Get-Volume -FilePath U:\

DriveLetter FriendlyName FileSystemType DriveType HealthStatus OperationalStatus SizeRemaining  Size
----------- ------------ -------------- --------- ------------ ----------------- -------------  ----
U           New Volume   NTFS           Fixed     Healthy      OK                     19.91 GB 20 GB

Get-Disk has all the information I need:

PS C:\Users\Administrator> Get-Disk | Select Manufacturer, SerialNumber, UniqueId

Manufacturer SerialNumber UniqueId
------------ ------------ --------
3PARdata     SGH622X73L   60002AC0000000000E006A980001AB73
3PARdata     SGH622X73L   60002AC0000000000E006A990001AB73
3PARdata     SGH622X73L   60002AC0000000000E006E9D0001AB73
3PARdata     SGH622X73L   60002AC0000000000E006E9E0001AB73
3PARdata     SGH622X73L   60002AC0000000000E006E9F0001AB73
3PARdata     SGH622X73L   60002AC0000000000E006EA00001AB73

My problem is, how do I filter out which of the above listing belongs to my logical volume U:\ ?

  • We can assist in troubleshooting the existing code you have, so we can see what you may be doing wrong, and perhaps offer a better solution. – Abraham Zinala Feb 12 '21 at 06:22
  • If you are saying you want to [combine these outputs, then, that would be similar to this answer I provided shortly ago](https://stackoverflow.com/search?q=combine+cmdlet+output). – postanote Feb 12 '21 at 06:27
  • Show us what you tried, and any errors you received. SO does have rules: [Provide MRE](https://stackoverflow.com/help/minimal-reproducible-example) --- [How to ask](https://stackoverflow.com/help/how-to-ask) --- [Don't ask](https://stackoverflow.com/help/dont-ask) --- [Proper Topic](https://stackoverflow.com/help/on-topic) --- [Why not upload images of code/errors?](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-errors-when-asking-a-question). – postanote Feb 12 '21 at 06:31
  • Edited qs to include more info and what I have tried so far – pabitra dalei Feb 12 '21 at 06:42
  • Are you saying these are network drives? If so, then this is not a thing, since network drives to file share, or slices of a disk storage system. If these are Windows Highly Available file server deployment or DFS shares, then that all point to a VIP, DFS share name, et all, that can also be a slice of a storage system. So not a physical drive at all. – postanote Feb 12 '21 at 06:43
  • These are SCSI drives exported from a storage system to my local system. – pabitra dalei Feb 12 '21 at 06:45
  • @DavidMartin You don't need WMI for this. – zett42 Feb 12 '21 at 08:16
  • @zett42.. Fantastic! This is what I needed – pabitra dalei Feb 12 '21 at 08:57
  • @DavidMartin Thanks for your response. For my need, zett42's answer is simple enough. – pabitra dalei Feb 12 '21 at 08:58

1 Answers1

0

@zett42's link worked for me. Posting it here again:

get-partition -DriveLetter U | get-disk