Windows Tip Sheet

All About Your Hard Drive

Look Mom, take 2: No-script hard drive info, this time using WMIC.

Last time I showed you how to get WMI information about hard drive utilization without writing a single line of VBScript. If you don’t have PowerShell but are running XP or 2003 (no, I haven’t tried this yet on Vista to know what has changed), you can use WMI command line.

Open a command prompt and type WMIC. If you’ve never run the command before it will just take a moment for the utility to configure itself. When it is finished, you’ll be at a WMIC prompt. WMIC has an interactive mode like NSLOOKUP.

At the WMIC prompt, type:

Logicaldisk where (drivetype='3') get DeviceID,Size,Freespace

You should something similar to this:

DeviceID FreeSpace Size
C: 382550016 15726702592
E: 684658688 24280993792
S: 684658688 24280993792

If you want to connect to remote computer use this syntax:

/node:DC01 Logicaldisk where (drivetype='3') get DeviceID,Size,Freespace

If the computername has any non-alphanumeric characters, then enclose it in quotes. One advantage to using WMIC is that you can specify multiple computer names separated by commas:

/node:server1,server2

or a file list:

/node:@servers.txt

Type exit to return to the command prompt. Once WMIC is installed you can run the command directly without having to use WMIC interactively:

Tech Help—Just An
E-Mail Away

Got a Windows, Exchange or virtualization question or need troubleshooting help? Or maybe you want a better explanation than provided in the manuals? Describe your dilemma in an e-mail to the MCPmag.com editors at editor@mcpmag.com; the best questions get answered in this column and garner the questioner with a nifty Redmond T-shirt.

When you send your questions, please include your full first and last name, location, certifications (if any) with your message. (If you prefer to remain anonymous, specify this in your message, but submit the requested information for verification purposes.)

C:\>wmic logicaldisk where (drivetype='3') get deviceid,freespace,size >drivereport.txt

This makes it very easy to save results, write batch files or create a scheduled task.

About the Author

Jeffery Hicks is an IT veteran with over 25 years of experience, much of it spent as an IT infrastructure consultant specializing in Microsoft server technologies with an emphasis in automation and efficiency. He is a multi-year recipient of the Microsoft MVP Award in Windows PowerShell. He works today as an independent author, trainer and consultant. Jeff has written for numerous online sites and print publications, is a contributing editor at Petri.com, and a frequent speaker at technology conferences and user groups.

Featured

  • OneDrive Users To Get Storage Options, Plus New Personal Vault

    Microsoft announced a few OneDrive enhancements, including storage-option additions, plus a new "Personal Vault" feature for added security assurance.

  • Cloud Services Starting To Overtake On-Prem Database Management Systems

    Database management system (DBMS) growth is happening more on the cloud services side than on the traditional "on-premises" side, according to a report by Gartner Inc.

  • How To Replace an Aging Domain Controller

    If the hardware behind your domain controllers has become outdated, here's a step-by-step guide to performing a hardware refresh.

  • Azure Backup for SQL Server 2008 Available at Preview Stage

    Microsoft added the option of using the Azure Backup service to provide recovery support for SQL Server 2008 and SQL Server 2008 R2 when those workloads are hosted on Azure virtual machines.

comments powered by Disqus

Office 365 Watch

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.