Home » Questions » Computers [ Ask a new question ]

How can I tell if Windows thinks a HDD is removable without a GUI?

How can I tell if Windows thinks a HDD is removable without a GUI?

I need to determine if Windows thinks that my SATA hard drives are "removable" or not. The problem is, its on a Hyper-V system, and I don't have access to the Disk Management GUI application. diskpart does not have this information, and I'm not sure where to turn now. How can I determine this via command line tools, or through PowerShell?

Asked by: Guest | Views: 312
Total answers/comments: 1
bert [Entry]

"This is very easy in PowerShell using the .NET Framework, I've just tested it on an external drive :)

PS C:\>$drive = New-Object system.io.driveinfo(""F:"")
PS C:\>$drive.DriveType
Removable

You can also use WMI:

C:\>wmic
wmic:root\cli>logicaldisk get caption,drivetype
Caption DriveType
C: 3
D: 5
E: 5
F: 2

Where drive types are:

0 - Unknown
1 - No Root Directory
2 - Removable Disk
3 - Local Disk
4 - Network Drive
5 - Compact Disk
6 - RAM Disk"