I Need To Make A Change With My IT Support! Call (225) 706-8414

Use WMI to print disk drives on remote Windows PC from command-line

You need to get a list of available physical disks on a remote machine from the DOS command-line.

Solution

As long as you an admin on the target machine (e.g., a Domain Admin, or in the local Administrators group), you can get this information using  WMI.

  1. If not already available, download and extract the PsTools suite
  2. Open a CMD window and change directory to the folder where you extracted the PsTools commands
  3. Use the PSEXEC command to run WMI on the remote machine (in this example, server1):
    C:>PsExec.exe \server1 wmic.exe logicaldisk get caption,providername,drivetype,volumename

    PsExec v1.98 – Execute processes remotely
    Copyright (C) 2001-2010 Mark Russinovich
    Sysinternals –www.sysinternals.comCaption  DriveType  ProviderName
    VolumeName
    C:       3
    D:       5
    E:       5
    F:       5                     U3 System
    G:       2
    I:        2
  4. The WMI output will tell you what drives are available; the drive type should be one of the following:
    2 == Remove drive (i.e. USB drive)
    3 == Local hard disk
    4 == Network disk
    5 == CD/DVD
    6 == RAM DiskAny other value means that WMI could not determine the type of disk.

atkb#486

 

Concerned About Cyber Attacks?

CLICK HERE >

Want to Migrate to the Cloud?

CLICK HERE >
Office 365

Ready to Experience Microsoft Office 365?

Want the latest IT news directly in your inbox? Subscribe now!