Directories in WMI

Every directory on a filesystem is represented in WMI by a Win32_Directory object, whose primary key is a Name property. Unsurprisingly, the value of this property, just like that of a CIM_DataFile, corresponds to the fully-qualified directory name. For example, the Win32_Directory object representing C:\Winnt on a system has the name C:\winnt.

The similarity between a Win32_Directory and a CIM_DataFile does not stop with the fact that both have a Name property. In fact, a Win32_Directory possesses every single property and method that a CIM_DataFile does, and vice versa. In other words, our entire discussion of CIM_DataFile objects applies equally to Win32_Directory objects. This similarity is not a coincidence. The reason ...

Get Windows Management Instrumentation (WMI) now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.