Tag Archives: WMIC

How to: list disks in Windows CMD

I guess everybody know their way with DIR command to list folder/drives content but what if you need to figure out which drives are available? I recently did a Windows Server 2012 core installation in native VHD boot scenario and it lead me to asking question above when trying to attach my VHDX file from Windows Setup Manager. So I decided to jot down options to list windows drive from CMD below:

1. WMIC option:

wmic logicaldisk get name


wmic logicaldisk get caption

2. fsutil utility:

fsutil fsinfo drives

3. diskpart. This was actually was the only way to list drives I was able to remember from the top of my head – but I didn’t like it as it requires entering into diskpart context and working from there. And it is easy to do something unrecoverable from this context ūüôā

list volume

4. PowerShell:

get-psdrive ‚Äďpsprovider filesystem

I draw most of the options from this article _ which features screenshots and more details on these commands.

Checking for Windows update presence via command line

Just a quick note on how to check if some specific Windows update is installed on the system via command prompt. I thought I already took a note of this, but was not able to find existing post on this. While investigating an issue or doing troubleshooting something more often than not you may need to make sure if some specific update is present in the system or not. And not always you may want to wade through GUI to check this. Let’s say you may want to automate this process or do some mass discovery by running script on multiple machines.

Option 1. Query WMI (Windows Management Instrumentation) namespace.

1-A. Using wmic.exe (powerful, user-friendly CLI to the WMI namespace):

wmic qfe get hotfixid | find "KB99999"

wmic qfe | find "KB99999"

1-B. Using PowerShell:

Get-WmiObject -query 'select * from win32_quickfixengineering' | foreach {$_.hotfixid}

Option 2. Using PS commandlet get-hotfix which was introduced in PS 2.0:

get-hotfix -id KB974332

So this should be enough for most of the cases.