Jump to content

Recommended Posts

Posted

hi, i need to know if there is any way to detect if a drive is flash media or not. I know there is a removable or fixed thing but i assume that it will see external hard drives as removable also. i just need to be able to distinguish between hdds and solid state/flash drives

thanks for any help

  • 2 weeks later...
Posted (edited)

Try searching for USB drive (there are lots of examples of it), that's what I did to create a detection and block script.

PS, welcome to the forums

Edited by Legacy99
Posted (edited)

Try the DriveGetDrive() and DriveGetType() Functions.

Alternatively, if you are familiar with WMI, you can use that to query drive info. *I Recommend*

$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\localhost\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select * from Win32_DiskDrive Where (InterfaceType like " & chr(34) & "%USB%" & chr(34) & ")")
For $objItem in $colItems
    msgbox(0,$objItem.Caption,$objItem.MediaType)
Next

http://msdn2.microsoft.com/en-us/library/a...132(VS.85).aspx

Edited by spudw2k

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...