Win32_Directory

Win32 Directory
root/cimv2dynamickey : Name

The Win32_Directory WMI class represents a directory entry on a computer system running Windows.

On this page

Main example

List instances

# All instances of Win32_Directory, with the main properties
Get-CimInstance -ClassName Win32_Directory |
    Select-Object -Property @(
        'CSName'
        'FSCreationClassName'
        'Name'
        'Caption'
        'Description'
        'Status'
        'Path'
    )

Examples

Filter with WQL

# WQL filter evaluated by the provider: AccessMask = 1 (FILE_READ_DATA (file) or FILE_LIST_DIRECTORY (directory))
Get-CimInstance -ClassName Win32_Directory -Filter 'AccessMask = 1' |
    Select-Object -Property @(
        'CSName'
        'FSCreationClassName'
        'Name'
        'Caption'
        'Description'
        'Status'
        'Path'
    )

The filter is evaluated by the WMI provider: less data is transferred than with Where-Object.

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'
    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'
    18809343 = 'ACCESS_SYSTEM_SECURITY'
}

Get-CimInstance -ClassName Win32_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 Win32_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 Win32_Directory
$cimClass.CimClassProperties |
    Select-Object -Property Name, CimType, Flags

# Methods of the class
$cimClass.CimClassMethods |
    Select-Object -Property Name, ReturnType

Properties

31 of 31 properties
NameTypeAccessDescription
AccessMaskuint32read

Bitmask that represents the access rights required to access or perform specific operations on the directory. For bit 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 (15)
ValueLabelDescription
1FILE_READ_DATA (file) or FILE_LIST_DIRECTORY (directory)Grants the right to read data from the file. For a directory, this value grants the right to list the contents of the directory.
2FILE_WRITE_DATA (file) or FILE_ADD_FILE (directory)Grants the right to write data to the file. For a directory, this value grants the right to create a file in the directory.
4FILE_APPEND_DATA (file) or FILE_ADD_SUBDIRECTORYGrants the right to append data to the file. For a directory, this value grants the right to create a subdirectory.
8FILE_READ_EAGrants the right to read extended attributes.
16FILE_WRITE_EAGrants the right to write extended attributes.
32FILE_EXECUTE (file) or FILE_TRAVERSE (directory)Grants the right to execute a file. For a directory, the directory can be traversed.
64FILE_DELETE_CHILD (directory)Grants the right to delete a directory and all of the files it contains (its children), even if the files are read-only.
128FILE_READ_ATTRIBUTESGrants the right to read file attributes.
256FILE_WRITE_ATTRIBUTESGrants the right to change file attributes.
65536DELETEGrants delete access.
131072READ_CONTROLGrants read access to the security descriptor and owner.
262144WRITE_DACGrants write access to the discretionary ACL.
524288WRITE_OWNERAssigns the write owner.
1048576SYNCHRONIZESynchronizes access and allows a process to wait for an object to enter the signaled state.
18809343ACCESS_SYSTEM_SECURITYControls the ability to get or set the SACL in an object's security descriptor.
Code
# 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'
    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'
    18809343 = 'ACCESS_SYSTEM_SECURITY'
}
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, AccessMask |
    Select-Object -Property @(
        'CSName'
        'FSCreationClassName'
        @{ Name = 'AccessMask'; Expression = { $accessMaskName[[int]$_.AccessMask] } }
    )
Archivebooleanread

Indicates whether the archive bit on the folder has been set. The archive bit is used by backup programs to identify files that should be backed up. If True, the file should be archived.

Code
# Value of Archive for each instance
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, Archive |
    Select-Object -Property CSName, FSCreationClassName, Archive
Captionstringread

A short textual description of the object.

Code
# Value of Caption for each instance
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, Caption |
    Select-Object -Property CSName, FSCreationClassName, Caption
Compressedbooleanread

Indicates whether or not the folder has been compressed. WMI recognizes folders compressed using WMI itself or using the graphical user interface; it does not, however, recognize .ZIP files as being compressed. If True, the file is compressed.

Code
# Value of Compressed for each instance
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, Compressed |
    Select-Object -Property CSName, FSCreationClassName, Compressed
CompressionMethodstringread

Algorithm or tool (usually a method) used to compress the logical file. If it is not possible (or not desired) to describe the compression scheme (perhaps because it is not known), use the following words: "Unknown" to represent that it is not known whether the logical file is compressed; "Compressed" to represent that the file is compressed, but either its compression scheme is not known or not disclosed; and "Not Compressed" to represent that the logical file is not compressed.

Code
# Value of CompressionMethod for each instance
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, CompressionMethod |
    Select-Object -Property CSName, FSCreationClassName, CompressionMethod
CreationClassName keystringread

Name of the first concrete class to appear in the inheritance chain used in the creation of an instance. When used with the other key properties of the class, this property allows all instances of this class and its subclasses to be uniquely identified.

Code
# Value of CreationClassName for each instance
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, CreationClassName |
    Select-Object -Property CSName, FSCreationClassName, CreationClassName
CreationDatedatetimeread

Date that the file system object was created. For more information on working with WMI date and time formats, see WMI Tasks: Dates and Times.

Code
# Value of CreationDate for each instance
# CIM cmdlets already return a DateTime object: no conversion is needed
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, CreationDate |
    Select-Object -Property CSName, FSCreationClassName, CreationDate
CSCreationClassName keystringread

Creation class name of the scoping computer system.

Code
# Value of CSCreationClassName for each instance
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, CSCreationClassName |
    Select-Object -Property CSName, FSCreationClassName, CSCreationClassName
CSName keystringread

Name of the computer where the file system object is stored.

Code
# Value of CSName for each instance
Get-CimInstance -ClassName Win32_Directory -Property FSCreationClassName, CSName |
    Select-Object -Property FSCreationClassName, CSName
Descriptionstringread

A textual description of the object.

Code
# Value of Description for each instance
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, Description |
    Select-Object -Property CSName, FSCreationClassName, Description
Drivestringread

Drive letter of the drive (including colon) where the file system object is stored.

Example: "c:"

Code
# Value of Drive for each instance
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, Drive |
    Select-Object -Property CSName, FSCreationClassName, Drive
EightDotThreeFileNamestringread

MS-DOS -compatible name for the folder.

Example: "c:\progra~1"

Code
# Value of EightDotThreeFileName for each instance
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, EightDotThreeFileName |
    Select-Object -Property CSName, FSCreationClassName, EightDotThreeFileName
Encryptedbooleanread

Indicates whether or not the folder has been encrypted. If True, the folder is encrypted.

Code
# Value of Encrypted for each instance
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, Encrypted |
    Select-Object -Property CSName, FSCreationClassName, Encrypted
EncryptionMethodstringread

Algorithm or tool used to encrypt the logical file. If it is not possible (or not desired) to describe the encryption scheme (perhaps for security reasons), use the following words: "Unknown" to represent that it is not known whether the logical file is encrypted; "Encrypted" to represent that the file is encrypted, but either its encryption scheme is not known or not disclosed; and "Not Encrypted" to represent that the logical file is not encrypted.

Code
# Value of EncryptionMethod for each instance
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, EncryptionMethod |
    Select-Object -Property CSName, FSCreationClassName, EncryptionMethod
Extensionstringread

File name extension for the file system object, not including the dot (.) that separates the extension from the file name.

Examples: "txt", "mof", "mdb"

Code
# Value of Extension for each instance
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, Extension |
    Select-Object -Property CSName, FSCreationClassName, Extension
FileNamestringread

File name (without the dot or extension) of the file.

Example: "autoexec"

Code
# Value of FileName for each instance
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, FileName |
    Select-Object -Property CSName, FSCreationClassName, FileName
FileSizeuint64read

Size of the file system object, in bytes. Although folders possess a FileSize property, the value 0 is always returned. To determine the size of a folder, use the FileSystemObject or add up the size of all the files stored in the folder.

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

Unit: bytes

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

File type (indicated by the Extension property).

For example, an .mdb file is likely to have the file type Microsoft Access Application. An .asp file likely has the file type HTML Document. Folders are typically reported simply as Folder.

Code
# Value of FileType for each instance
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, FileType |
    Select-Object -Property CSName, FSCreationClassName, FileType
FSCreationClassName keystringread

Class of the file system.

Code
# Value of FSCreationClassName for each instance
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName |
    Select-Object -Property CSName, FSCreationClassName
FSName keystringread

Type of file system (NTFS, FAT, FAT32) installed on the drive where the file or folder is located.

Code
# Value of FSName for each instance
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, FSName |
    Select-Object -Property CSName, FSCreationClassName, FSName
Hiddenbooleanread

Indicates whether the file system object is hidden. If True, the file is hidden.

Code
# Value of Hidden for each instance
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, Hidden |
    Select-Object -Property CSName, FSCreationClassName, Hidden
InstallDatedatetimeread

Indicates when the object was installed. Lack of a value does not indicate that the object is not installed.

Code
# Value of InstallDate for each instance
# CIM cmdlets already return a DateTime object: no conversion is needed
Get-CimInstance -ClassName Win32_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
# Value of InUseCount for each instance
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, InUseCount |
    Select-Object -Property CSName, FSCreationClassName, InUseCount
LastAccesseddatetimeread

Date the file was last accessed. For more information on working with WMI date and time formats, see WMI Tasks: Dates and Times.

Code
# Value of LastAccessed for each instance
# CIM cmdlets already return a DateTime object: no conversion is needed
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, LastAccessed |
    Select-Object -Property CSName, FSCreationClassName, LastAccessed
LastModifieddatetimeread

Date the file was last modified. For more information on working with WMI date and time formats, see WMI Tasks: Dates and Times.

Code
# Value of LastModified for each instance
# CIM cmdlets already return a DateTime object: no conversion is needed
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, LastModified |
    Select-Object -Property CSName, FSCreationClassName, LastModified
Name keystringread

The Name property is a string representing the inherited name that serves as a key of a logical file instance within a file system. Full path names should be provided. Example: C:\Windows\system\win.ini

Code
# Value of Name for each instance
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, Name |
    Select-Object -Property CSName, FSCreationClassName, Name
Pathstringread

Path for the file. The path includes the leading and trailing backslashes, but not the drive letter or the folder name.

For the folder c:\windows\system32\wbem, the path is \windows\system32\. For the folder c:\scripts, the path is \.

Code
# Value of Path for each instance
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, Path |
    Select-Object -Property CSName, FSCreationClassName, Path
Readablebooleanread

Indicates whether you can read items in the folder. If True, the file can be read.

Code
# Value of Readable for each instance
Get-CimInstance -ClassName Win32_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
# Value of Status for each instance
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, Status |
    Select-Object -Property CSName, FSCreationClassName, Status
Systembooleanread

Indicates whether the object is a system file. If True, the file is a system file

Code
# Value of System for each instance
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, System |
    Select-Object -Property CSName, FSCreationClassName, System
Writeablebooleanread

If True, the file can be written.

Code
# Value of Writeable for each instance
Get-CimInstance -ClassName Win32_Directory -Property CSName, FSCreationClassName, Writeable |
    Select-Object -Property CSName, FSCreationClassName, Writeable

Methods

ChangeSecurityPermissions #

Class method that changes the security permissions for the logical file specified in the object path.

uint32 ChangeSecurityPermissions([in] Win32_SecurityDescriptor SecurityDescriptor, [in] uint32 Option);

Parameters

ParameterTypeDirectionDescription
SecurityDescriptorWin32_SecurityDescriptorin

Expression that resolves to an instance of Win32_SecurityDescriptor. This descriptor contains new security permissions for the instance of Win32_PageFile.

Optionuint32in

Security privilege to be modified. For example, to change the owner and discretionary access control list (DACL) security, use:

Option = 1 + 4

-or-

Option = CHANGE_OWNER_SECURITY_INFORMATION | CHANGE_DACL_SECURITY_INFORMATION

Return values

ValueLabelDescription
0SuccessThe request is successful.
2Access DeniedAccess is denied.
8Unspecified failureAn unspecified failure occurred.
9Invalid objectThe specified name is not valid.
10Object already existsThe specified object already exists.
11File system not NTFSThe file system is not an NTFS file system.
12Platform not NT/Windows 2000The platform is not Windows.
13Drive not the sameThe drive is not the same.
14Directory not emptyThe directory is not empty.
15Sharing violationThere is a sharing violation.
16Invalid start fileThe specified start file is not valid.
17Privilege not heldA privilege required for the operation is not held.
21Invalid parameterA specified parameter is not valid.

Call the ChangeSecurityPermissions method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_Directory -Filter "CSName = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'ChangeSecurityPermissions'
    Arguments   = @{
        SecurityDescriptor = $null
        Option             = 1
    }
    WhatIf      = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $returnValueName = @{
        0 = 'Success'
        2 = 'Access Denied'
        8 = 'Unspecified failure'
        9 = 'Invalid object'
        10 = 'Object already exists'
        11 = 'File system not NTFS'
        12 = 'Platform not NT/Windows 2000'
        13 = 'Drive not the same'
        14 = 'Directory not empty'
        15 = 'Sharing violation'
        16 = 'Invalid start file'
        17 = 'Privilege not held'
        21 = 'Invalid parameter'
    }
    $returnValueName[[int]$result.ReturnValue]
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

ChangeSecurityPermissionsEx #

Class method that changes the security permissions for the logical file specified in the object path.

uint32 ChangeSecurityPermissionsEx(
    [in] Win32_SecurityDescriptor SecurityDescriptor,
    [in] uint32 Option,
    [out] string StopFileName,
    [in] string StartFileName,
    [in] boolean Recursive
);

Parameters

ParameterTypeDirectionDescription
SecurityDescriptorWin32_SecurityDescriptorin

Expression that resolves to an instance of Win32_SecurityDescriptor. This parameter contains new security permissions for the instance of Win32_PageFile.

Optionuint32in

Security privilege to be modified. For example, to change the owner and discretionary access control list (DACL) security, use the following:

Option = 1 + 4

-or-

Option = CHANGE_OWNER_SECURITY_INFORMATION | CHANGE_DACL_SECURITY_INFORMATION

StopFileNamestringout

Name of the file or directory where the ChangeSecurityPermissionsEx method failed. This parameter is null if the method succeeds.

StartFileNamestringin

Names the child file or directory to use as a starting point for ChangeSecurityPermissionsEx. Typically, the *StartFileName* parameter is the *StopFileName* parameter that specifies the file or directory where an error occurred from the previous method call. If this parameter is null, the operation is performed on the file or directory that is specified in the ExecMethod call. This parameter is optional.

If *StartFileName* is used, *Recursive* must be set to true as well.

Recursivebooleanin

If true, the change of ownership is applied recursively to files and directories within the directory specified by the CIM_LogicalFile instance. For file instances, the *Recursive* input parameter is ignored. This parameter is optional.

Return values

ValueLabelDescription
0SuccessThe request is successful.
2Access DeniedAccess is denied.
8Unspecified failureAn unspecified failure occurred.
9Invalid objectThe specified name is not valid.
10Object already existsThe specified object already exists.
11File system not NTFSThe file system is not an NTFS file system.
12Platform not NT/Windows 2000The platform is not Windows.
13Drive not the sameThe drive is not the same.
14Directory not emptyThe directory is not empty.
15Sharing violationThere is a sharing violation.
16Invalid start fileThe specified start file is not valid.
17Privilege not heldA privilege required for the operation is not held.
21Invalid parameterA specified parameter is not valid.

Call the ChangeSecurityPermissionsEx method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_Directory -Filter "CSName = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'ChangeSecurityPermissionsEx'
    Arguments   = @{
        SecurityDescriptor = $null
        Option             = 1
        StartFileName      = 'Example'
        Recursive          = $false
    }
    WhatIf      = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $returnValueName = @{
        0 = 'Success'
        2 = 'Access Denied'
        8 = 'Unspecified failure'
        9 = 'Invalid object'
        10 = 'Object already exists'
        11 = 'File system not NTFS'
        12 = 'Platform not NT/Windows 2000'
        13 = 'Drive not the same'
        14 = 'Directory not empty'
        15 = 'Sharing violation'
        16 = 'Invalid start file'
        17 = 'Privilege not held'
        21 = 'Invalid parameter'
    }
    $returnValueName[[int]$result.ReturnValue]
    $result.StopFileName
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

Compress #

Class method that compresses the logical file (or directory) specified in the object path.

uint32 Compress();

Return values

ValueLabelDescription
0The request was successful.
2Access was denied.
8An unspecified failure occurred.
9The name specified was not valid.
10The object specified already exists.
11The file system is not an NTFS.
12The platform is not Windows.
13The drive is not the same.
14The directory is not empty.
15There has been a sharing violation.
16The start file specified was not valid.
17A privilege required for the operation is not held.
21A parameter specified is not valid.

Call the Compress method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_Directory -Filter "CSName = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'Compress'
    WhatIf      = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $returnValueName = @{
        0 = 'The request was successful'
        2 = 'Access was denied'
        8 = 'An unspecified failure occurred'
        9 = 'The name specified was not valid'
        10 = 'The object specified already exists'
        11 = 'The file system is not an NTFS'
        12 = 'The platform is not Windows'
        13 = 'The drive is not the same'
        14 = 'The directory is not empty'
        15 = 'There has been a sharing violation'
        16 = 'The start file specified was not valid'
        17 = 'A privilege required for the operation is not held'
        21 = 'A parameter specified is not valid'
    }
    $returnValueName[[int]$result.ReturnValue]
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

CompressEx #

Class method that compresses the logical file (or directory) specified in the object path.

uint32 CompressEx(
    [out] string StopFileName,
    [in] string StartFileName,
    [in] boolean Recursive
);

Parameters

ParameterTypeDirectionDescription
StopFileNamestringout

Name of the file or directory where the CompressEx method failed. This parameter will be NULL if the method succeeds.

StartFileNamestringin

Names the child file or directory to use as a starting point for CompressEx. The *StartFileName* parameter is typically the *StopFileName* parameter specifying the file or directory at which an error occurred from the previous method call. If this parameter is NULL, the operation is performed on the file or directory specified in the ExecMethod call.

If *StartFileName* is used, *Recursive* must be set to true as well.

Recursivebooleanin

If true, the change of ownership will be applied recursively to files and directories within the directory specified by the CIM_LogicalFile instance.

Note: For file instances, the *Recursive* input parameter is ignored.

Return values

ValueLabelDescription
0The request was successful.
2Access was denied.
8An unspecified failure occurred.
9The name specified was not valid.
10The object specified already exists.
11The file system is not an NTFS.
12The platform is not Windows.
13The drive is not the same.
14The directory is not empty.
15There has been a sharing violation.
16The start file specified was not valid.
17A privilege required for the operation is not held.
21A parameter specified is not valid.

Call the CompressEx method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_Directory -Filter "CSName = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'CompressEx'
    Arguments   = @{
        StartFileName = 'Example'
        Recursive     = $false
    }
    WhatIf      = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $returnValueName = @{
        0 = 'The request was successful'
        2 = 'Access was denied'
        8 = 'An unspecified failure occurred'
        9 = 'The name specified was not valid'
        10 = 'The object specified already exists'
        11 = 'The file system is not an NTFS'
        12 = 'The platform is not Windows'
        13 = 'The drive is not the same'
        14 = 'The directory is not empty'
        15 = 'There has been a sharing violation'
        16 = 'The start file specified was not valid'
        17 = 'A privilege required for the operation is not held'
        21 = 'A parameter specified is not valid'
    }
    $returnValueName[[int]$result.ReturnValue]
    $result.StopFileName
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

Copy #

Class method that copies the logical file or directory specified in the object path to the location specified by the input parameter.

uint32 Copy([in] string FileName);

Parameters

ParameterTypeDirectionDescription
FileNamestringin

Return values

ValueLabelDescription
0The request was successful.
2Access was denied.
8An unspecified failure occurred.
9The name specified was not valid.
10The object specified already exists.
11The file system is not NTFS.
12The platform is not Windows.
13The drive is not the same.
14The directory is not empty.
15There has been a sharing violation.
16The start file specified was not valid.
17A privilege required for the operation is not held.
21A parameter specified is not valid.

Call the Copy method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_Directory -Filter "CSName = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'Copy'
    Arguments   = @{ FileName = 'Example' }
    WhatIf      = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $returnValueName = @{
        0 = 'The request was successful'
        2 = 'Access was denied'
        8 = 'An unspecified failure occurred'
        9 = 'The name specified was not valid'
        10 = 'The object specified already exists'
        11 = 'The file system is not NTFS'
        12 = 'The platform is not Windows'
        13 = 'The drive is not the same'
        14 = 'The directory is not empty'
        15 = 'There has been a sharing violation'
        16 = 'The start file specified was not valid'
        17 = 'A privilege required for the operation is not held'
        21 = 'A parameter specified is not valid'
    }
    $returnValueName[[int]$result.ReturnValue]
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

CopyEx #

Class method that copies the logical file or directory specified in the object path to the location specified by the *FileName* parameter.

uint32 CopyEx(
    [in] string FileName,
    [out] string StopFileName,
    [in] string StartFileName,
    [in] boolean Recursive
);

Parameters

ParameterTypeDirectionDescription
FileNamestringin

Fully qualified name of the copy of the file (or directory). Example: c:\temp\newdirectory.

StopFileNamestringout

Name of the file or directory where the CopyEx method failed. This parameter will be null if the method succeeds.

StartFileNamestringin

Names the child file or directory to use as a starting point for CopyEx. The *StartFileName* parameter is typically the *StopFileName* parameter specifying the file or directory at which an error occurred from the previous method call. If this parameter is NULL, the operation is performed on the file or directory specified in the ExecMethod call.

If *StartFileName* is used, *Recursive* must be set to true as well.

Recursivebooleanin

If true, files and directories will be copied recursively within the directory specified by the CIM_LogicalFile instance.

Note: For file instances, the *Recursive* input parameter is ignored.

Return values

ValueLabelDescription
0The request was successful.
2Access was denied.
8An unspecified failure occurred.
9The name specified was not valid.
10The object specified already exists.
11The file system is not NTFS.
12The platform is not Windows.
13The drive is not the same.
14The directory is not empty.
15There has been a sharing violation.
16The start file specified was not valid.
17A privilege required for the operation is not held.
21A parameter specified is not valid.

Call the CopyEx method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_Directory -Filter "CSName = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'CopyEx'
    Arguments   = @{
        FileName      = 'Example'
        StartFileName = 'Example'
        Recursive     = $false
    }
    WhatIf      = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $returnValueName = @{
        0 = 'The request was successful'
        2 = 'Access was denied'
        8 = 'An unspecified failure occurred'
        9 = 'The name specified was not valid'
        10 = 'The object specified already exists'
        11 = 'The file system is not NTFS'
        12 = 'The platform is not Windows'
        13 = 'The drive is not the same'
        14 = 'The directory is not empty'
        15 = 'There has been a sharing violation'
        16 = 'The start file specified was not valid'
        17 = 'A privilege required for the operation is not held'
        21 = 'A parameter specified is not valid'
    }
    $returnValueName[[int]$result.ReturnValue]
    $result.StopFileName
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

Delete #

Class method that deletes the logical file (or directory) specified in the object path.

uint32 Delete();

Return values

ValueLabelDescription
0The request was successful.
2Access was denied.
8An unspecified failure occurred.
9The name specified was not valid.
10The object specified already exists.
11The file system is not NTFS.
12The platform is not Windows.
13The drive is not the same.
14The directory is not empty.
15There has been a sharing violation.
16The start file specified was not valid.
17A privilege required for the operation is not held.
21A parameter specified is not valid.

Call the Delete method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_Directory -Filter "CSName = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'Delete'
    WhatIf      = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $returnValueName = @{
        0 = 'The request was successful'
        2 = 'Access was denied'
        8 = 'An unspecified failure occurred'
        9 = 'The name specified was not valid'
        10 = 'The object specified already exists'
        11 = 'The file system is not NTFS'
        12 = 'The platform is not Windows'
        13 = 'The drive is not the same'
        14 = 'The directory is not empty'
        15 = 'There has been a sharing violation'
        16 = 'The start file specified was not valid'
        17 = 'A privilege required for the operation is not held'
        21 = 'A parameter specified is not valid'
    }
    $returnValueName[[int]$result.ReturnValue]
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

DeleteEx #

Class method that deletes the logical file (or directory) specified in the object path.

uint32 DeleteEx([out] string StopFileName, [in] string StartFileName);

Parameters

ParameterTypeDirectionDescription
StopFileNamestringout

Name of the file or directory where the DeleteEx method failed. This parameter will be null if the method succeeds.

StartFileNamestringin

Names the child file or directory to use as a starting point for DeleteEx. The *StartFileName* parameter is typically the *StopFileName* parameter specifying the file or directory at which an error occurred from the previous method call. If this parameter is NULL, the operation is performed on the file or directory specified in the ExecMethod call.

Return values

ValueLabelDescription
0The request was successful.
2Access was denied.
8An unspecified failure occurred.
9The name specified was not valid.
10The object specified already exists.
11The file system is not NTFS.
12The platform is not Windows.
13The drive is not the same.
14The directory is not empty.
15There has been a sharing violation.
16The start file specified was not valid.
17A privilege required for the operation is not held.
21A parameter specified is not valid.

Call the DeleteEx method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_Directory -Filter "CSName = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'DeleteEx'
    Arguments   = @{ StartFileName = 'Example' }
    WhatIf      = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $returnValueName = @{
        0 = 'The request was successful'
        2 = 'Access was denied'
        8 = 'An unspecified failure occurred'
        9 = 'The name specified was not valid'
        10 = 'The object specified already exists'
        11 = 'The file system is not NTFS'
        12 = 'The platform is not Windows'
        13 = 'The drive is not the same'
        14 = 'The directory is not empty'
        15 = 'There has been a sharing violation'
        16 = 'The start file specified was not valid'
        17 = 'A privilege required for the operation is not held'
        21 = 'A parameter specified is not valid'
    }
    $returnValueName[[int]$result.ReturnValue]
    $result.StopFileName
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

GetEffectivePermission #

Class method that determines whether the caller has the aggregated permissions specified by the *Permissions* argument not only on the file object, but on the share the file or directory resides on (if it is on a share).

boolean GetEffectivePermission([in] uint32 Permissions);

Parameters

ParameterTypeDirectionDescription
Permissionsuint32in

Bitmap of permissions that the caller can inquire about.

Call the GetEffectivePermission method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_Directory -Filter "CSName = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'GetEffectivePermission'
    Arguments   = @{ Permissions = 0 }
    WhatIf      = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $result.ReturnValue
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

Rename #

Class method that renames the logical file (or directory) specified in the object path.

uint32 Rename([in] string FileName);

Parameters

ParameterTypeDirectionDescription
FileNamestringin

Return values

ValueLabelDescription
0The request was successful.
2Access was denied.
8An unspecified failure occurred.
9The name specified was not valid.
10The object specified already exists.
11The file system is not NTFS.
12The platform is not Windows.
13The drive is not the same.
14The directory is not empty.
15There has been a sharing violation.
16The start file specified was not valid.
17A privilege required for the operation is not held.
21A parameter specified is not valid.

Call the Rename method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_Directory -Filter "CSName = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'Rename'
    Arguments   = @{ FileName = 'Example' }
    WhatIf      = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $returnValueName = @{
        0 = 'The request was successful'
        2 = 'Access was denied'
        8 = 'An unspecified failure occurred'
        9 = 'The name specified was not valid'
        10 = 'The object specified already exists'
        11 = 'The file system is not NTFS'
        12 = 'The platform is not Windows'
        13 = 'The drive is not the same'
        14 = 'The directory is not empty'
        15 = 'There has been a sharing violation'
        16 = 'The start file specified was not valid'
        17 = 'A privilege required for the operation is not held'
        21 = 'A parameter specified is not valid'
    }
    $returnValueName[[int]$result.ReturnValue]
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

TakeOwnerShip #

Class method that obtains ownership of the logical file specified in the object path.

uint32 TakeOwnerShip();

Return values

ValueLabelDescription
0The request was successful.
2Access was denied.
8An unspecified failure occurred.
9The name specified was not valid.
10The object specified already exists.
11The file system is not NTFS.
12The platform is not Windows.
13The drive is not the same.
14The directory is not empty.
15There has been a sharing violation.
16The start file specified was not valid.
17A privilege required for the operation is not held.
21A parameter specified is not valid.

Call the TakeOwnerShip method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_Directory -Filter "CSName = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'TakeOwnerShip'
    WhatIf      = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $returnValueName = @{
        0 = 'The request was successful'
        2 = 'Access was denied'
        8 = 'An unspecified failure occurred'
        9 = 'The name specified was not valid'
        10 = 'The object specified already exists'
        11 = 'The file system is not NTFS'
        12 = 'The platform is not Windows'
        13 = 'The drive is not the same'
        14 = 'The directory is not empty'
        15 = 'There has been a sharing violation'
        16 = 'The start file specified was not valid'
        17 = 'A privilege required for the operation is not held'
        21 = 'A parameter specified is not valid'
    }
    $returnValueName[[int]$result.ReturnValue]
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

TakeOwnerShipEx #

Class method that obtains ownership of the logical file specified in the object path.

uint32 TakeOwnerShipEx(
    [out] string StopFileName,
    [in] string StartFileName,
    [in] boolean Recursive
);

Parameters

ParameterTypeDirectionDescription
StopFileNamestringout

Name of the file or directory where the TakeOwnerShipEx method failed. This parameter is NULL if the method succeeds.

StartFileNamestringin

Names the child file or directory to use as a starting point for TakeOwnerShipEx. The *StartFileName* parameter is typically the *StopFileName* parameter that specifies the file or directory at which an error occurred from the previous method call. If this parameter is NULL, the operation is performed on the file or directory specified in the ExecMethod call.

If *StartFileName* is used, *Recursive* must be set to true as well.

Recursivebooleanin

If True, the change of ownership is applied recursively to files and directories within the directory specified by the CIM_LogicalFile instance.

Note: For file instances, the *Recursive* input parameter is ignored.

Return values

ValueLabelDescription
0The request was successful.
2Access was denied.
8An unspecified failure occurred.
9The name specified was not valid.
10The object specified already exists.
11The file system is not NTFS.
12The platform is not Windows.
13The drive is not the same.
14The directory is not empty.
15There has been a sharing violation.
16The start file specified was not valid.
17A privilege required for the operation is not held.
21A parameter specified is not valid.

Call the TakeOwnerShipEx method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_Directory -Filter "CSName = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'TakeOwnerShipEx'
    Arguments   = @{
        StartFileName = 'Example'
        Recursive     = $false
    }
    WhatIf      = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $returnValueName = @{
        0 = 'The request was successful'
        2 = 'Access was denied'
        8 = 'An unspecified failure occurred'
        9 = 'The name specified was not valid'
        10 = 'The object specified already exists'
        11 = 'The file system is not NTFS'
        12 = 'The platform is not Windows'
        13 = 'The drive is not the same'
        14 = 'The directory is not empty'
        15 = 'There has been a sharing violation'
        16 = 'The start file specified was not valid'
        17 = 'A privilege required for the operation is not held'
        21 = 'A parameter specified is not valid'
    }
    $returnValueName[[int]$result.ReturnValue]
    $result.StopFileName
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

Uncompress #

Class method that uncompresses the logical file (or directory) specified in the object path.

uint32 Uncompress();

Return values

ValueLabelDescription
0The request was successful.
2Access was denied.
8An unspecified failure occurred.
9The name specified was not valid.
10The object specified already exists.
11The file system is not NTFS.
12The platform is not Windows.
13The drive is not the same.
14The directory is not empty.
15There has been a sharing violation.
16The start file specified was not valid.
17A privilege required for the operation is not held.
21A parameter specified is not valid.

Call the Uncompress method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_Directory -Filter "CSName = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'Uncompress'
    WhatIf      = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $returnValueName = @{
        0 = 'The request was successful'
        2 = 'Access was denied'
        8 = 'An unspecified failure occurred'
        9 = 'The name specified was not valid'
        10 = 'The object specified already exists'
        11 = 'The file system is not NTFS'
        12 = 'The platform is not Windows'
        13 = 'The drive is not the same'
        14 = 'The directory is not empty'
        15 = 'There has been a sharing violation'
        16 = 'The start file specified was not valid'
        17 = 'A privilege required for the operation is not held'
        21 = 'A parameter specified is not valid'
    }
    $returnValueName[[int]$result.ReturnValue]
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

UncompressEx #

Class method that uncompresses the logical file (or directory) specified in the object path.

uint32 UncompressEx(
    [out] string StopFileName,
    [in] string StartFileName,
    [in] boolean Recursive
);

Parameters

ParameterTypeDirectionDescription
StopFileNamestringout

Name of the file/directory where the UncompressEx method failed. This parameter will be NULL if the method succeeds.

StartFileNamestringin

Names the child file/directory to use as a starting point for UncompressEx. The *StartFileName* parameter is typically the *StopFileName* parameter specifying the file or directory at which an error occurred from the previous method call. If this parameter is NULL, the operation is performed on the file or directory specified in the ExecMethod call.

If *StartFileName* is used, *Recursive* must be set to true as well.

Recursivebooleanin

If true, the change of ownership will be applied recursively to files and directories within the directory specified by the CIM_LogicalFile instance. Note: for file instances, the *Recursive* input parameter is ignored.

Return values

ValueLabelDescription
0The request was successful.
2Access was denied.
8An unspecified failure occurred.
9The name specified was not valid.
10The object specified already exists.
11The file system is not NTFS.
12The platform is not Windows.
13The drive is not the same.
14The directory is not empty.
15There has been a sharing violation.
16The start file specified was not valid.
17A privilege required for the operation is not held.
21A parameter specified is not valid.

Call the UncompressEx method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_Directory -Filter "CSName = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'UncompressEx'
    Arguments   = @{
        StartFileName = 'Example'
        Recursive     = $false
    }
    WhatIf      = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $returnValueName = @{
        0 = 'The request was successful'
        2 = 'Access was denied'
        8 = 'An unspecified failure occurred'
        9 = 'The name specified was not valid'
        10 = 'The object specified already exists'
        11 = 'The file system is not NTFS'
        12 = 'The platform is not Windows'
        13 = 'The drive is not the same'
        14 = 'The directory is not empty'
        15 = 'There has been a sharing violation'
        16 = 'The start file specified was not valid'
        17 = 'A privilege required for the operation is not held'
        21 = 'A parameter specified is not valid'
    }
    $returnValueName[[int]$result.ReturnValue]
    $result.StopFileName
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

Remarks

The Win32_Directory class is derived from CIM_Directory.

Overview

Folders are file system objects designed to contain other file system objects. This does not mean that all folders are alike, however. Instead, folders can vary considerably. Some folders are operating system folders, which generally should not be modified by a script. Some folders are read-only, which means that users can access the contents of that folder but cannot add to, delete from, or modify those contents. Some folders are compressed for optimal storage, while others are hidden and not visible to users.

WMI uses the Win32_Directory class to manage folders. Significantly, the properties and methods available in this class are identical to the properties and methods available in the CIM_DataFile class, the class used to manage files. This means that after you have learned how to manage folders using WMI, you will, without any extra work, also know how to manage files.

The Win32_Subdirectory association class is also used to manage files and folders. The Win32_Subdirectory class relates a folder and its immediate subfolders. For example, in the folder structure C:\Scripts\Logs, Logs is a subfolder of Scripts, and Scripts is a subfolder of the root folder C:\. However, Logs is not considered a subfolder of C:\.

You can retrieve the properties of any folder in the file system using the Win32_Directory class. The properties available using this class are shown in Table 11.1. To retrieve the properties for a single folder, construct a Windows Query Language (WQL) query for the Win32_Directory class, making sure that you include the name of the folder. For example, this query binds to the folder D:\Archive:

Copy "SELECT * FROM Win32_Directory WHERE Name = 'D:\Archive'"

When specifying a file or folder name in a WQL query, be sure you use two backslashes (\\) to separate path components.

If you want to limit data retrieval to a single disk drive, include a Where clause specifying the drive letter. For example, this query returns a list of all the folders on drive C:

"SELECT * FROM Win32_Directory WHERE Drive = 'C:'"

If you need to enumerate all the folders on a computer, be aware that this query can take an extended time to complete.

Inheritance

Superclass chain

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

Known subclasses

No known subclass.

Requirements

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

Dynamic Provider("CIMWin32") UUID("{8502C4C7-5FBB-11D2-AAC1-006008C78BC7}") 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.