External drive check with WMI – Updated

July 11, 2016 — Leave a comment

So, I didn’t expect an USB external hard drive to appear as a local disk but there it was “E:\ Local Disk”. I wrote a script a few months ago thinking I covered all my bases. However, I wrote it expecting all external drives to appear as a Removable Disk. Note the additional line of my batch file identifies disk using a USB interface. Problem solved!

@echo off
echo "Please enter a valid hostname or type exit to quit"
set /p host="Enter Hostname: "
if %host% == exit goto escape
wmic /node:"%host%" diskdrive where interfacetype='USB' list brief
wmic /node:"%host%" logicaldisk get description, name
goto main

No Comments

Be the first to start the conversation!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s