Windows XP comes with a host of new command line utilities never before seen in the Windows line of operating systems. As such, many of these utilities are unfamiliar territory for most IT professionals, which is unfortunate because these utilities can come in very handy in a number of situations if you know that they exist and how to use them.
One of these new command line utilities is called Fsutil and it is designed to allow you to perform a multitude of file system-related operations on both FAT and NTFS file systems. This utility has 11 main subcommands, and each one of these subcommands has its own set of parameters. When you add them all up, you'll discover that the Fsutil command line utility will allow you to perform a grand total of 58 different operations.
While the majority of these tasks are designed to configure, enable, or disable some aspect of the file system, a good portion of them are probative in nature and can provide extremely valuable information when configuring or troubleshooting a system. Unfortunately, drilling down through all of these subcommands and parameters on the command line can be a grueling operation. As such, most of this valuable information lies untapped.
I recently found myself needing easy access to some of the information the Fsutil command line utility provides and decided to write an HTML Application (HTA), called the Fsutil Query Tool, which uses Windows Script Host, VBScript, and HTML Components (HTC) to bring the probative capabilities of the Fsutil command to the Windows user interface. You can download the Fsutil Query Tool and follow the instructions below on how to use it.
A new HTA interface
Before I introduce you to the Fsutil Query Tool, let me set the stage a bit. If you've downloaded and used some of the other HTAs that I've created for TechRepublic, such as the Dir Commander, you know that my interface of choice has been a dialog box design with option buttons, check boxes, and other standard dialog box fare. However, given the number of commands that I set out to implement with the Fsutil Query Tool, a dialog box design was too cramped.
I then briefly contemplated a wizard design that would walk through the various options. But, again, the number of commands posed a problem as there would be too many screens for a wizard design to be a very practical approach.
As I was pondering my next approach, I was using Windows Explorer to perform some file management operations and it hit me that a pull-down menu system would be the perfect interface design for the Fsutil Query Tool. As I began exploring some methods of implementing a pull-down menu system in an HTA, I remembered that a few years back I encountered an HTML editor that was created using HTA technology and recalled that it had a brilliantly implemented pull-down menu system.
After a bit of digging, I tracked down the HTML Editor HTA at Jans Freeware Collection, which hosts a rather large collection of terrific programs created by Jan Verhoeven. After studying Jan's HTML Editor HTA, which uses HTC and DHTML to create a dynamic pull-down menu system, I decided that I had found the interface concept that I was looking for.
Since I borrowed the framework of Jan's pull-down menu system for the Fsutil Query Tool, I'd like to acknowledge his work and thank him for making his programs freely available to the public.
Incidentally, if you're interested in learning more about HTC technology, you really should check out the article, "Using HTML Components to Implement DHTML Behaviors in Script," on Microsoft's MSDN site.
Fsutil Query Tool summary
As I mentioned, the Fsutil command line utility will allow you to perform 58 different file system-related operations on both FAT and NTFS file systems. When you break down the operations into two categories, you have 33 operations that are designed to configure, enable, or disable some aspect of the file system and 25 operations that are designed to query the file system and provide you with valuable information that would be difficult to get elsewhere in the operating system. Since the latter operations are the focus of the Fsutil Query Tool, let's take a brief look at each of these operations.
To begin with, the Fsutil command has 11 main subcommands and each one of these subcommands has its own set of parameters. The Fsutil Query Tool provides access to 10 of these subcommands and 25 parameters.
The Behavior subcommand is designed to allow you to control and query what Microsoft calls the file system behaviors. The query aspect of this subcommand's five parameters provides the following information:
- disable8dot3: Checks the status of the file system's ability to create 8.3 character-length file names on FAT- and NTFS-formatted volumes.
- allowextchar: Determines whether characters from the extended character set, including diacritic characters, can be used in 8.3 short file names on NTFS volumes.
- disablelastaccess: Determines whether NTFS updates the last access timestamp on each directory when it lists the directories on an NTFS volume.
- quotanotify: Checks the status of NTFS quota violations as reported in the system log.
- mftzone: Checks the status of the master file table (MFT) Zone, a reserved area that enables the MFT to expand as needed in order to prevent MFT fragmentation.
The Dirty subcommand works with a volume's dirty bit setting, which is used to indicate whether the file system is in an inconsistent state. More specifically, the dirty bit is set because changes were made to the volume and the computer shutdown before the changes were completely committed or because some type of corruption was detected on the volume. When the dirty bit is set and you restart the computer, Chkdsk automatically runs to verify the file system integrity and attempts to fix any problems with the disk. The query aspect of this subcommand provides a single parameter.
The File subcommand is designed to perform sophisticated file management operations typically used by support professionals. The query aspect of this subcommand comes from two of its six parameters:
- findbysid: Finds files on NTFS volumes that belong to a specified user as identified by their SID (security identifier).
- querryallocranges: Queries the allocated ranges for a file on an NTFS volume, which is useful for determining whether a file has sparse regions.
The Fsinfo subcommand is strictly probative in nature and provides you with five parameters:
- drives: Lists all drives in the computer.
- drivetype: Queries a drive and lists its type.
- volumeinfo: Lists information for the specified volume, such as the file system and whether the volume supports case-sensitive file names, unicode in file names, or disk quotas.
- ntfsinfo: Lists NTFS specific volume information for the specified volume, such as the number of sectors, total clusters, free clusters, and the start and end of the MFT Zone.
- statistics: Lists file system statistics for the specified volume, such as metadata, log file, and MFT reads and writes.
The Objectid subcommand is designed to work with object identifiers (also known as OIDs), which are internal objects used by the Distributed Link Tracking (DLT) Client service and File Replication Service (FRS) to track other objects such as files, directories, and links. The query aspect of this subcommand comes from a single parameter:
The Quota subcommand is designed to work with disk quotas on NTFS volumes in order to provide more precise control of network-based storage. The query aspect of this subcommand comes from three of its six parameters:
- query: Investigates existing disk quotas on NTFS volumes.
- track: Tracks disk usage on the specified volume.
- violations: Searches the system and application logs and determines if any quota violations have been detected or whether a user has reached their quota threshold or quota limit.
The Reparsepoint subcommand is designed to work with reparse points on NTFS volumes. The query aspect of this subcommand comes from a single parameter:
The Sparse subcommand is designed to work with sparse files, which are files with one or more regions of unallocated data in them. The query aspect of this subcommand comes from two of its four parameters:
- queryflag: Queries a sparse file.
- queryrange: Scans a sparse file looking for ranges that may contain nonzero data.
The USN subcommand is designed to manage the update sequence number (USN) change journal, which provides a persistent log of all changes made to files on the volume. The query aspect of this subcommand comes from three of its five parameters:
- queryjournal: Queries a volume's USN data to gather information about the current change journal, its records, and its capacity.
- readdata: Reads the USN data for a file.
- enumdata: Enumerates and lists the change journal entries between two specified boundaries.
The Volume subcommand is designed to be used on volumes. The query aspect of this subcommand comes from one of its two parameters:
Downloading and installing the Fsutil Query Tool
You can download Greg Shultz's Fsutil Query Tool by following this link or clicking on the Downloads link in the navigation bar on the left of this page. Once you download the FsutilQueryTool.zip archive file, manually installing the application on your hard disk is easy. To do so, create a folder anywhere on your hard disk and name it something like Fsutil QT. Then, unzip the FsutilQueryTool.zip archive file and copy the following four files to the folder:
Because some antivirus programs filter out HTA and HTC files, I have given three of the files TXT extensions. You will, therefore, need to rename the files FsutilQT.txt, button.txt, and menu.txt to FsutilQT.hta, button.htc, and menu.htc.
The FsutilQT.ico file provides the Fsutil Query Tool with the icon that it uses for the control menu and the taskbar. The FsutilQT.hta file is, of course, the main HTML Application. And the button.htc and menu.htc files are the HTML Components that implement the DHTML buttons and menu system.
Using the Fsutil Query Tool
Now that you've installed the Fsutil Query Tool and have a basic understanding of the 25 operations that this tool provides, let's take a look at how it works. To begin, locate the FsutilQT.hta file and double-click it. When you do, you'll see the Fsutil Query Tool window, as shown in Figure A. As you can see, there are 10 pull-down menus that correspond to each of the Fsutil subcommands I explained earlier. Each of the menus contains the query-related parameters associated with the various subcommands.
|The pull-down menu system gives this HTA a true application look and feel.|
|Popups provide you with a brief explanation of the item's function.|
|Many of the Fsutil subcommand parameters require additional, user supplied, parameters.|
|The Fsutil Query Tool cleanly displays the results in a Command Prompt window.|
|This popup dialog box will only remain on the screen for two seconds.|
|When you see the Help window, you have to type Fsutil in the Search keyword box in order to track down help for the Fsutil command line utility.|
Now, as you can see, in this particular example, the Help window is titled Windows XP Professional Help, which is appropriate since my test systems are running that version of the operating system. Unfortunately, I didn't have an opportunity to test this Help feature of the Fsutil Query Tool on a system running Windows XP Home Edition. However, I would assume that XP Home would have a similar Windows.chm file and that the Fsutil Query Tool Help feature would work correctly.
If you are running Windows XP Home Edition, please post a message in the Discussion Center and let me know if the Fsutil Query Tool Help feature works with this version of the operating system.
As always, feel free to post a message or e-mail me if you have any questions, problems, or suggestions pertaining to the Fsutil Query Tool.
Greg Shultz is a freelance Technical Writer. Previously, he has worked as Documentation Specialist in the software industry, a Technical Support Specialist in educational industry, and a Technical Journalist in the computer publishing industry.