CIM_Directory

CIM Directory
root/cimv2abstractkey : Name

The CIM_Directory class represents a file type that logically groups the data files that it contains and provides path information for the grouped files.

On this page

Main example

List instances

# Abstract class: Get-CimInstance returns the instances of its subclasses
Get-CimInstance -ClassName CIM_Directory |
    Select-Object -Property @(
        'CSName'
        'FSCreationClassName'
        'Name'
        'Caption'
        'Description'
        'Status'
        'Path'
    )

Abstract class: it has no instances of its own. Get-CimInstance returns the instances of its subclasses (Win32_Directory).

Examples

Decode numeric values

# Lookup table for AccessMask (values documented by Microsoft)
$accessMaskName = @{
    1 = 'FILE_READ_DATA (file) or FILE_LIST_DIRECTORY (directory)'
    2 = 'FILE_WRITE_DATA (file) or FILE_ADD_FILE (directory)'
    4 = 'FILE_APPEND_DATA (file) or FILE_ADD_SUBDIRECTORY (directory)'
    8 = 'FILE_READ_EA'
    16 = 'FILE_WRITE_EA'
    32 = 'FILE_EXECUTE (file) or FILE_TRAVERSE (directory)'
    64 = 'FILE_DELETE_CHILD (directory)'
    128 = 'FILE_READ_ATTRIBUTES'
    256 = 'FILE_WRITE_ATTRIBUTES'
    65536 = 'DELETE'
    131072 = 'READ_CONTROL'
    262144 = 'WRITE_DAC'
    524288 = 'WRITE_OWNER'
    1048576 = 'SYNCHRONIZE'
}

Get-CimInstance -ClassName CIM_Directory |
    Select-Object -Property @(
        'CSName'
        'FSCreationClassName'
        'Name'
        'Caption'
        'Description'
        'Status'
        'Path'
    )

Query a remote computer (CIM session)

review before running
# Name of the remote computer
$computerName = 'SERVER01'
# The CIM session (WSMan by default) can be reused for several queries
$cimSession = New-CimSession -ComputerName $computerName
try {
    Get-CimInstance -CimSession $cimSession -ClassName CIM_Directory |
        Select-Object -Property @(
            'CSName'
            'FSCreationClassName'
            'Name'
            'Caption'
            'Description'
            'Status'
            'Path'
        )
} finally {
    Remove-CimSession -CimSession $cimSession
}

WSMan (WinRM) is used by default. For a host without WinRM, create the session with -SessionOption (New-CimSessionOption -Protocol Dcom). Add -Credential to use another account.

Show the class structure

# Class structure: properties, types and flags (Key, ReadOnly…)
$cimClass = Get-CimClass -ClassName CIM_Directory
$cimClass.CimClassProperties |
    Select-Object -Property Name, CimType, Flags

Properties

31 of 31 properties
NameTypeAccessDescription
AccessMaskuint32read

Bitmask that represents the access rights required to access or perform specific operations on the directory. For values, see File and Directory Access Rights Constants.

Note: On FAT volumes, the FULL_ACCESS value is returned instead, which indicates no security has been set on the object.

Values (14)
ValueLabelDescription
1FILE_READ_DATA (file) or FILE_LIST_DIRECTORY (directory)
2FILE_WRITE_DATA (file) or FILE_ADD_FILE (directory)
4FILE_APPEND_DATA (file) or FILE_ADD_SUBDIRECTORY (directory)
8FILE_READ_EA
16FILE_WRITE_EA
32FILE_EXECUTE (file) or FILE_TRAVERSE (directory)
64FILE_DELETE_CHILD (directory)
128FILE_READ_ATTRIBUTES
256FILE_WRITE_ATTRIBUTES
65536DELETE
131072READ_CONTROL
262144WRITE_DAC
524288WRITE_OWNER
1048576SYNCHRONIZE
Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of AccessMask for each instance
# Lookup table for AccessMask (values documented by Microsoft)
$accessMaskName = @{
    1 = 'FILE_READ_DATA (file) or FILE_LIST_DIRECTORY (directory)'
    2 = 'FILE_WRITE_DATA (file) or FILE_ADD_FILE (directory)'
    4 = 'FILE_APPEND_DATA (file) or FILE_ADD_SUBDIRECTORY (directory)'
    8 = 'FILE_READ_EA'
    16 = 'FILE_WRITE_EA'
    32 = 'FILE_EXECUTE (file) or FILE_TRAVERSE (directory)'
    64 = 'FILE_DELETE_CHILD (directory)'
    128 = 'FILE_READ_ATTRIBUTES'
    256 = 'FILE_WRITE_ATTRIBUTES'
    65536 = 'DELETE'
    131072 = 'READ_CONTROL'
    262144 = 'WRITE_DAC'
    524288 = 'WRITE_OWNER'
    1048576 = 'SYNCHRONIZE'
}
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, AccessMask |
    Select-Object -Property @(
        'CSName'
        'FSCreationClassName'
        @{ Name = 'AccessMask'; Expression = { $accessMaskName[[int]$_.AccessMask] } }
    )
Archivebooleanread

If True, the file should be archived.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of Archive for each instance
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, Archive |
    Select-Object -Property CSName, FSCreationClassName, Archive
Captionstringread

Short textual description of the object.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of Caption for each instance
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, Caption |
    Select-Object -Property CSName, FSCreationClassName, Caption
Compressedbooleanread

If True, the file is compressed.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of Compressed for each instance
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, Compressed |
    Select-Object -Property CSName, FSCreationClassName, Compressed
CompressionMethodstringread

Free-form string that indicates the algorithm or tool used to compress the logical file. If the compression scheme is unknown or not described, use "Unknown". If the logical file is compressed, but the compression scheme is unknown or not described, use "Compressed". If the logical file is not compressed, use "Not Compressed".

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of CompressionMethod for each instance
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, CompressionMethod |
    Select-Object -Property CSName, FSCreationClassName, CompressionMethod
CreationClassName keystringread

Name of the class.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of CreationClassName for each instance
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, CreationClassName |
    Select-Object -Property CSName, FSCreationClassName, CreationClassName
CreationDatedatetimeread

Date and time that the file was created.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of CreationDate for each instance
# CIM cmdlets already return a DateTime object: no conversion is needed
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, CreationDate |
    Select-Object -Property CSName, FSCreationClassName, CreationDate
CSCreationClassName keystringread

Class of the computer system.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of CSCreationClassName for each instance
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, CSCreationClassName |
    Select-Object -Property CSName, FSCreationClassName, CSCreationClassName
CSName keystringread

Name of the computer system.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of CSName for each instance
Get-CimInstance -ClassName CIM_Directory -Property FSCreationClassName, CSName |
    Select-Object -Property FSCreationClassName, CSName
Descriptionstringread

Textual description of the object.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of Description for each instance
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, Description |
    Select-Object -Property CSName, FSCreationClassName, Description
Drivestringread

Drive letter (including the colon that follows the drive letter) of the file. This property is inherited from CIM_LogicalFile.

Example: "c:"

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of Drive for each instance
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, Drive |
    Select-Object -Property CSName, FSCreationClassName, Drive
EightDotThreeFileNamestringread

DOS-compatible file name. This property is inherited from CIM_LogicalFile.

Example: "c:\progra~1"

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of EightDotThreeFileName for each instance
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, EightDotThreeFileName |
    Select-Object -Property CSName, FSCreationClassName, EightDotThreeFileName
Encryptedbooleanread

If True, the file is encrypted.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of Encrypted for each instance
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, Encrypted |
    Select-Object -Property CSName, FSCreationClassName, Encrypted
EncryptionMethodstringread

Free-form string that identifies the algorithm or tool used to encrypt a logical file. If the encryption scheme is not indulged (for security reasons, for example), use "Unknown". If the file is encrypted, but either its encryption scheme is unknown or not disclosed, use "Encrypted". If the logical file is not encrypted, use "Not Encrypted".

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of EncryptionMethod for each instance
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, EncryptionMethod |
    Select-Object -Property CSName, FSCreationClassName, EncryptionMethod
Extensionstringread

File name extension without the preceding period (dot).

Example: "txt", "mof", "mdb"

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of Extension for each instance
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, Extension |
    Select-Object -Property CSName, FSCreationClassName, Extension
FileNamestringread

File name without the file name extension.

Example: "MyDataFile"

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of FileName for each instance
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, FileName |
    Select-Object -Property CSName, FSCreationClassName, FileName
FileSizeuint64read

Size of the file, in bytes.

For more information about using uint64 values in scripts, see Scripting in WMI.

Unit: bytes

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of FileSize for each instance
# FileSize is expressed in bytes: converted to GB
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, FileSize |
    Select-Object -Property @(
        'CSName'
        'FSCreationClassName'
        @{ Name = 'FileSizeGB'; Expression = { [math]::Round($_.FileSize / 1GB, 2) } }
    )
FileTypestringread

Descriptor that represents the file type (indicated by the Extension property).

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of FileType for each instance
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, FileType |
    Select-Object -Property CSName, FSCreationClassName, FileType
FSCreationClassName keystringread

Class of the file system.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of FSCreationClassName for each instance
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName |
    Select-Object -Property CSName, FSCreationClassName
FSName keystringread

Name of the file system.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of FSName for each instance
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, FSName |
    Select-Object -Property CSName, FSCreationClassName, FSName
Hiddenbooleanread

If True, the file is hidden.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of Hidden for each instance
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, Hidden |
    Select-Object -Property CSName, FSCreationClassName, Hidden
InstallDatedatetimeread

Date and time when the object was installed. This property does not need a value to indicate that the object is installed.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of InstallDate for each instance
# CIM cmdlets already return a DateTime object: no conversion is needed
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, InstallDate |
    Select-Object -Property CSName, FSCreationClassName, InstallDate
InUseCountuint64read

Number of "file opens" that are currently active against the file.

For more information about using uint64 values in scripts, see Scripting in WMI.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of InUseCount for each instance
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, InUseCount |
    Select-Object -Property CSName, FSCreationClassName, InUseCount
LastAccesseddatetimeread

Date and time that the file was last accessed.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of LastAccessed for each instance
# CIM cmdlets already return a DateTime object: no conversion is needed
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, LastAccessed |
    Select-Object -Property CSName, FSCreationClassName, LastAccessed
LastModifieddatetimeread

Date and time that the file was last modified.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of LastModified for each instance
# CIM cmdlets already return a DateTime object: no conversion is needed
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, LastModified |
    Select-Object -Property CSName, FSCreationClassName, LastModified
Name keystringread

Inherited name that serves as a key of a logical file instance within a file system (provide full path names).

Example: "C:\Windows\system\win.ini"

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of Name for each instance
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, Name |
    Select-Object -Property CSName, FSCreationClassName, Name
Pathstringread

Path of the file including the leading and trailing backslashes. This property is inherited from CIM_LogicalFile.

Example: "\windows\system\"

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of Path for each instance
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, Path |
    Select-Object -Property CSName, FSCreationClassName, Path
Readablebooleanread

If True, the file can be read.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of Readable for each instance
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, Readable |
    Select-Object -Property CSName, FSCreationClassName, Readable
Statusstringread

String that indicates the current status of the object.

Values include the following:

Values (12)
ValueLabelDescription
OKOK
ErrorError
DegradedDegraded
UnknownUnknown
Pred FailPred Fail
StartingStarting
StoppingStopping
ServiceService
StressedStressed
NonRecoverNonRecover
No ContactNo Contact
Lost CommLost Comm
Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of Status for each instance
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, Status |
    Select-Object -Property CSName, FSCreationClassName, Status
Systembooleanread

If True, the file is a system file.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of System for each instance
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, System |
    Select-Object -Property CSName, FSCreationClassName, System
Writeablebooleanread

If True, the file can be written.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of Writeable for each instance
Get-CimInstance -ClassName CIM_Directory -Property CSName, FSCreationClassName, Writeable |
    Select-Object -Property CSName, FSCreationClassName, Writeable

Remarks

The CIM_Directory class is derived from CIM_LogicalFile.

WMI does not implement this class. For more information about classes derived from CIM_Directory, see Win32 Classes.

This documentation is derived from the CIM class descriptions published by the DMTF. Microsoft may have made changes to correct minor errors, conform to Microsoft SDK documentation standards, or provide more information.

Inheritance

Superclass chain

  1. CIM_ManagedSystemElement
  2. CIM_LogicalElement
  3. CIM_LogicalFile
  4. CIM_Directory

Known subclasses

Requirements

Namespace
root/cimv2
Minimum client
Windows Vista
Minimum server
Windows Server 2008
MOF file
CIMWin32.mof
DLL
CIMWin32.dll
Class qualifiers

Abstract UUID("{8502C55F-5FBB-11D2-AAC1-006008C78BC7}") DisplayName("Directories (CIM)") AMENDMENT

Microsoft source

Source: Microsoft Learn

Descriptions, properties and methods come from the Microsoft documentation (MicrosoftDocs/win32 repository), published under the CC BY 4.0 licence. Formatting and translations are specific to this site; the PowerShell examples are written for it.