I have a flash drive which I formatted so that the volume label on the drive is "PHILIP".
I am using Get-PSDrive H -PSProvider FileSystem
to determine if the drive is plugged in, however I would really like to determine if the drive is plugged in by the volume label, i.e. Get-PSDrive -VolumeLabel PHILIP -PSProvider FileSystem
. Of course the VolumeLabel
parameter does not exist so this doesn't work.
Is there a way to list the drives in a computer by volume name?
You can use WMI, I guess: