You can get this information from two places: wmic diskdrive and wmic logicaldisk - (and of course, their wmi bindings for equivilents).
The output of wmic diskdrive - note the capability descriptions and media type
Availability BytesPerSector Capabilities CapabilityDescriptions Caption CompressionMethod ConfigManagerErrorCode ConfigManagerUserConfig CreationClassName DefaultBlockSize Description DeviceID ErrorCleared ErrorDescription ErrorMethodology FirmwareRevision Index InstallDate InterfaceType LastErrorCode Manufacturer MaxBlockSize MaxMediaSize MediaLoaded MediaType MinBlockSize Model Name NeedsCleaning NumberOfMediaSupported Partitions PNPDeviceID PowerManagementCapabilities PowerManagementSupported SCSIBus SCSILogicalUnit SCSIPort SCSITargetId SectorsPerTrack SerialNumber Signature Size Status StatusInfo SystemCreationClassName SystemName TotalCylinders TotalHeads TotalSectors TotalTracks TracksPerCylinder
512 {3, 4} {"Random Access", "Supports Writing"} Hitachi HDS723030ALA640 0 FALSE Win32_DiskDrive Disk drive \\.\PHYSICALDRIVE0 MKAO 0 IDE (Standard disk drives) TRUE Fixed hard disk media Hitachi HDS723030ALA640 \\.\PHYSICALDRIVE0 1 IDE\DISKHITACHI_HDS723030ALA640_________________MKAOAA10\4&15828421&0&0.0.0 0 0 0 0 63 KM3010HYNKXXGW 3000590369280 OK Win32_ComputerSystem NYX 364801 255 5860528065 93024255 255
HTC Android Phone USB Device 0 FALSE Win32_DiskDrive Disk drive \\.\PHYSICALDRIVE4 0000 4 USB (Standard disk drives) TRUE HTC Android Phone USB Device \\.\PHYSICALDRIVE4 0 USBSTOR\DISK&VEN_HTC&PROD_ANDROID_PHONE&REV_0000\HT24YTV03821&0 0 0 0 0 HT24YTV03820 0 OK Win32_ComputerSystem NYX
512 {3, 4} {"Random Access", "Supports Writing"} Samsung SSD 840 Series 0 FALSE Win32_DiskDrive Disk drive \\.\PHYSICALDRIVE1 DXT0 1 IDE (Standard disk drives) TRUE Fixed hard disk media Samsung SSD 840 Series \\.\PHYSICALDRIVE1 2 IDE\DISKSAMSUNG_SSD_840_SERIES__________________DXT08B0Q\4&15828421&0&0.1.0 0 0 0 1 63 1SG4ENCA4A8251 J 3142097946 250056737280 OK Win32_ComputerSystem NYX 30401 255 488392065 7752255 255
512 {3, 4} {"Random Access", "Supports Writing"} ST92503010AS 0 FALSE Win32_DiskDrive Disk drive \\.\PHYSICALDRIVE3 0005 3 IDE (Standard disk drives) TRUE Fixed hard disk media ST92503010AS \\.\PHYSICALDRIVE3 1 IDE\DISKST92503010AS____________________________0005LVM1\4&15828421&0&0.3.0 0 0 0 3 63 Y50HBBJ8 1668369528 250056737280 OK Win32_ComputerSystem NYX 30401 255 488392065 7752255 255
512 {3, 4} {"Random Access", "Supports Writing"} FUJITSU MHW2040BH 0 FALSE Win32_DiskDrive Disk drive \\.\PHYSICALDRIVE2 0000 2 IDE (Standard disk drives) TRUE Fixed hard disk media FUJITSU MHW2040BH \\.\PHYSICALDRIVE2 2 IDE\DISKFUJITSU_MHW2040BH_______________________0000001C\4&15828421&0&0.2.0 0 0 0 2 63 1KX07T2B57FL 976588 40007761920 OK Win32_ComputerSystem NYX 4864 255 78140160 1240320 255
HTC Android Phone USB Device 0 FALSE Win32_DiskDrive Disk drive \\.\PHYSICALDRIVE5 0000 5 USB (Standard disk drives) TRUE HTC Android Phone USB Device \\.\PHYSICALDRIVE5 0 USBSTOR\DISK&VEN_HTC&PROD_ANDROID_PHONE&REV_0000\HT24YTV03821&1 0 1 0 0 HT24YTV03821 0 OK Win32_ComputerSystem NYX
And here, the output of wmic logicaldisk - description here is what's mainly of interest.
Access Availability BlockSize Caption Compressed ConfigManagerErrorCode ConfigManagerUserConfig CreationClassName Description DeviceID DriveType ErrorCleared ErrorDescription ErrorMethodology FileSystem FreeSpace InstallDate LastErrorCode MaximumComponentLength MediaType Name NumberOfBlocks PNPDeviceID PowerManagementCapabilities PowerManagementSupported ProviderName Purpose QuotasDisabled QuotasIncomplete QuotasRebuilding Size Status StatusInfo SupportsDiskQuotas SupportsFileBasedCompression SystemCreationClassName SystemName VolumeDirty VolumeName VolumeSerialNumber
0 C: FALSE Win32_LogicalDisk Local Fixed Disk C: 3 NTFS 139243769856 255 12 C: 249690058752 FALSE TRUE Win32_ComputerSystem NYX 24FCB3E2
0 D: FALSE Win32_LogicalDisk Local Fixed Disk D: 3 NTFS 2459783610368 255 12 D: 3000457228288 FALSE TRUE Win32_ComputerSystem NYX New Volume C6DFE01A
G: Win32_LogicalDisk Removable Disk G: 2 G: Win32_ComputerSystem NYX
H: Win32_LogicalDisk Removable Disk H: 2 H: Win32_ComputerSystem NYX
0 Q: Win32_LogicalDisk Local Fixed Disk Q: 3 12 Q: Win32_ComputerSystem NYX
0 Y: FALSE Win32_LogicalDisk Local Fixed Disk Y: 3 NTFS 77826355200 255 12 Y: 250057060352 FALSE TRUE Win32_ComputerSystem NYX Drive of Impending Doom CCC0980F
As for where this information is from - the disks themselves should have that information in smart (from what I can tell from smartmontools, some of the values reported are different , ssd's wouldn't have spin up time, for example). On linux hdparm gives you detailed information, the same way using wmic would (but much more conveniently)
Removable vs non removable drive is set on a flag on the drive - this is actually switchable with the right tools.
In short, it asks the disk