Finding Out A Drives’ FileSystem

by Jul 16, 2009

If you ever needed a tool to find out the type of file system for any drive, take a look at this simple PowerShell function:

function Get-FileSystem($letter='C:') {
if (!(Test-Path $letter)) {
Throw "Drive $letter does not exist."


Get-FileSystem expects a drive letter such as "D:" and returns the filesystem used by that drive.

Get-FileSystem D:

Basically, this function demonstrates how you can access a specific WMI instance by using the [WMI] type accelerator. It accepts any WMI class name as long as you add the specific key property/properties that distinguish the instances. In case of Win32_LogicalDisk, this property is the drive letter.

Since the function is supposed to only return the filesystem, from all the information returned by the WMI instance only the FileSystem property is returned. Check out what you get when you omit ".FileSystem"! Pipe the result to Format-List * to see all available information:

Get-FileSystem C: | Format-List *