1

In Windows, is there a command/function/cmdlet which I can call to help me differentiate between an internal (fixed) HDD and an external (portable) USB HDD?

PowerShell commands, such as Get-Volume, state that my plugged in USB HDD is "Fixed".

Context: I am trying to write a BitLocker script which encrypts all internal hard drives, but does not encrypt removable/portable USB hard drives.

2
  • What you want to do is impossible to achieve reliably because Windows cannot distinguish between the two. Whether your USB HDD is shown as "fixed" depends entirely on the disk and the driver, there is nothing you can do about it. Any disk can identify as internal or external regardless of true state. Though you could use identification of a 'USB' disk as a rough workaround.
    – qasdfdsaq
    Commented Aug 18, 2015 at 13:21
  • I had a feeling this may be the case. Using the notion of being connected to USB could work? If I could determine storage devices connected via USB then I could ignore those in the encryption script.
    – A_Murselaj
    Commented Aug 18, 2015 at 13:31

2 Answers 2

2

Get-PhysicalDisk includes the property BusType that might be something you can use. I am not sure what all the possible values returned could be, but I have two USB drives attached to my laptop, along with the local drive. This is the output I get: Get-PhysicalDisk | select FriendlyName, BusType enter image description here

1
  • Thanks, Shawn. I have gone ahead and used BusType for my script.
    – A_Murselaj
    Commented Aug 24, 2015 at 15:12
0

Try something like:

Get-WmiObject -Class Win32_LogicalDisk -Property * | Where {$_.DriveType -eq 3}

https://msdn.microsoft.com/en-us/library/aa394173%28v=vs.85%29.aspx

  • Unknown (0)
  • No Root Directory (1)
  • Removable Disk (2)
  • Local Disk (3)
  • Network Drive (4)
  • Compact Disc (5)
  • RAM Disk (6)
3
  • Thanks for the suggestion. Unfortunately, the portable HDD still shows as a local disk.
    – A_Murselaj
    Commented Aug 18, 2015 at 12:04
  • Sorry - didn't have an external disk to hand to try so i mounted a virtual DVD, network drive etc and wittled down as much as I could.
    – Fazer87
    Commented Aug 18, 2015 at 13:06
  • No worries. I'm still no further. If you have any further suggestions please say.
    – A_Murselaj
    Commented Aug 18, 2015 at 13:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .