- 1 year ago
How can I determine if an SSD drive is fixed drive or connected on USB?
Comment
1 / 1
To determine if an SSD drive is connected as a fixed drive or via USB, you can use the Windows Management Instrumentation (WMI) in PowerShell. Here's an example PowerShell script to retrieve this information:
powershell$driveLetter = "C:" # Specify the drive letter of the SSD drive
# Get the drive information using WMI
$drive = Get-WmiObject -Class Win32_DiskDrive | Where-Object { $_.DeviceID -like "*$driveLetter" }
if ($drive.InterfaceType -eq "USB") {
Write-Output "SSD drive '$($drive.Caption)' is connected via USB."
} else {
Write-Output "SSD drive '$($drive.Caption)' is a fixed drive."
}
Make sure to replace $driveLetter
with the actual drive letter of the SSD drive you want to check.
This script retrieves the drive information using the Win32_DiskDrive
class from WMI. It then checks the InterfaceType
property of the drive object to determine if it's connected via USB. If the InterfaceType
is "USB", it means the SSD drive is connected via USB. Otherwise, it's considered a fixed drive.