In a nutshell
- Build a list of available drives.
- Try to resolve the driveletter to an
UNCname. - Try to
pingthe drive.
Edit regarding Bill’s comment
if Google is not the referer, EE doesn’t show the answer for free. Links to EE are not helpful.
OP found the article I’ve mentioned in my original answer and was kind enough to include the source code for the solution to his question.