Win32_ClusterShare

Win32 Cluster Share
root/cimv2dynamickey : Name

The Win32_ClusterShare class represents a shared resource on a cluster.

On this page

Main example

List instances

# All instances of Win32_ClusterShare, with the main properties
Get-CimInstance -ClassName Win32_ClusterShare |
    Select-Object -Property Name, Description, Status, Path, InstallDate

Examples

Filter with WQL

# WQL filter evaluated by the provider: Type = 0 (Disk Drive)
Get-CimInstance -ClassName Win32_ClusterShare -Filter 'Type = 0' |
    Select-Object -Property Name, Description, Status, Path, InstallDate

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

Decode numeric values

# Lookup table for Type (values documented by Microsoft)
$typeName = @{
    0 = 'Disk Drive'
    1 = 'Print Queue'
    2 = 'Device'
    3 = 'IPC'
    2147483648 = 'Disk Drive Admin'
    2147483649 = 'Print Queue Admin'
    2147483650 = 'Device Admin'
    2147483651 = 'IPC Admin'
}

Get-CimInstance -ClassName Win32_ClusterShare |
    Select-Object -Property @(
        'Name'
        'Description'
        'Status'
        'Path'
        'InstallDate'
        @{ Name = 'Type'; Expression = { $typeName[[int]$_.Type] } }
    )

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_ClusterShare |
        Select-Object -Property Name, Description, Status, Path, InstallDate
} 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_ClusterShare
$cimClass.CimClassProperties |
    Select-Object -Property Name, CimType, Flags

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

Properties

11 of 11 properties
NameTypeAccessDescription
AccessMaskuint32read

This property is obsolete and is no longer used. Use the Win32_Share.GetAccessMask method instead. The value of the AccessMask property is set to null by WMI. For more information about setting access when a share is created, see the Create method.

Code
# Value of AccessMask for each instance
Get-CimInstance -ClassName Win32_ClusterShare -Property Name, AccessMask |
    Select-Object -Property Name, AccessMask
AllowMaximumbooleanread

Number of concurrent users for this resource has been limited. If True, the value in the MaximumAllowed property is ignored.

Code
# Value of AllowMaximum for each instance
Get-CimInstance -ClassName Win32_ClusterShare -Property Name, AllowMaximum |
    Select-Object -Property Name, AllowMaximum
Captionstringread

A short textual description of the object.

Code
# Value of Caption for each instance
Get-CimInstance -ClassName Win32_ClusterShare -Property Name, Caption |
    Select-Object -Property Name, Caption
Descriptionstringread

A textual description of the object.

Code
# Value of Description for each instance
Get-CimInstance -ClassName Win32_ClusterShare -Property Name, Description |
    Select-Object -Property Name, Description
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_ClusterShare -Property Name, InstallDate |
    Select-Object -Property Name, InstallDate
MaximumAlloweduint32read

Limit on the maximum number of users allowed to use this resource concurrently. The value is only valid if the AllowMaximum property is set to FALSE.

Code
# Value of MaximumAllowed for each instance
Get-CimInstance -ClassName Win32_ClusterShare -Property Name, MaximumAllowed |
    Select-Object -Property Name, MaximumAllowed
Name keystringread

Alias given to a path set up as a share on a computer system running Windows.

Windows 2008 example: "\SERVER01\public" - Windows Server 2008 requires that you place the UNC in the name.

Code
# Value of Name for each instance
Get-CimInstance -ClassName Win32_ClusterShare -Property Name |
    Select-Object -Property Name
Pathstringread

Local path of the Windows share.

Example: "C:\Program Files"

Code
# Value of Path for each instance
Get-CimInstance -ClassName Win32_ClusterShare -Property Name, Path |
    Select-Object -Property Name, Path
ServerNamestringread

The cluster server on which the share is hosted.

Code
# Value of ServerName for each instance
Get-CimInstance -ClassName Win32_ClusterShare -Property Name, ServerName |
    Select-Object -Property Name, ServerName
Statusstringread

String that indicates the current status of the object. Operational and non-operational status can be defined. Operational status can include "OK", "Degraded", and "Pred Fail". "Pred Fail" indicates that an element is functioning properly, but is predicting a failure (for example, a SMART-enabled hard disk drive).

Non-operational status can include "Error", "Starting", "Stopping", and "Service". "Service" can apply during disk mirror-resilvering, reloading a user permissions list, or other administrative work. Not all such work is online, but the managed element is neither "OK" nor in one of the other states.

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_ClusterShare -Property Name, Status |
    Select-Object -Property Name, Status
Typeuint32read

Type of resource being shared. Types include: disk drives, print queues, interprocess communications (IPC), and general devices.

Values (8)
ValueLabelDescription
0Disk Drive
1Print Queue
2Device
3IPC
2147483648Disk Drive Admin
2147483649Print Queue Admin
2147483650Device Admin
2147483651IPC Admin
Code
# Value of Type for each instance
# Lookup table for Type (values documented by Microsoft)
$typeName = @{
    0 = 'Disk Drive'
    1 = 'Print Queue'
    2 = 'Device'
    3 = 'IPC'
    2147483648 = 'Disk Drive Admin'
    2147483649 = 'Print Queue Admin'
    2147483650 = 'Device Admin'
    2147483651 = 'IPC Admin'
}
Get-CimInstance -ClassName Win32_ClusterShare -Property Name, Type |
    Select-Object -Property @(
        'Name'
        @{ Name = 'Type'; Expression = { $typeName[[int]$_.Type] } }
    )

Methods

Create static#

Creates a new Win32_ClusterShare instance.

uint32 Create(
    [in] string Path,
    [in] string Name,
    [in] uint32 Type,
    [in] uint32 MaximumAllowed,
    [in] string Description,
    [in] string Password,
    [in] Win32_SecurityDescriptor Access
);

Parameters

ParameterTypeDirectionDescription
Pathstringin

Local path of the Windows share.

Example, "C:\Program Files".

Namestringin

The alias to a path set up as a share on a computer system running Windows.

Example, "public".

Typeuint32in

Type of resource being shared. Types include: disk drives, print queues, interprocess communications (IPC), and general devices.

MaximumAlloweduint32in

Limit on the maximum number of users allowed to use this resource concurrently.

Descriptionstringin

Description of the object.

Passwordstringin

TBD

AccessWin32_SecurityDescriptorin

Optional embedded instance of a Win32_SecurityDescriptor class that contains the security descriptor for the new share.

Call the Create method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
$methodParameters = @{
    ClassName  = 'Win32_ClusterShare'
    MethodName = 'Create'
    Arguments  = @{
        Path           = 'Example'
        Name           = 'Example'
        Type           = 1
        MaximumAllowed = 0
        Description    = 'Example'
        Password       = 'Example'
        Access         = $null
    }
    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.

Delete #

Deletes a Win32_ClusterShare instance.

uint32 Delete();

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_ClusterShare -Filter "Name = '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) {
    $result.ReturnValue
}

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

GetAccessMask #

Returns a bitmap with the access rights to the share.

uint32 GetAccessMask();

Call the GetAccessMask 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_ClusterShare -Filter "Name = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'GetAccessMask'
    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.

SetShareInfo #

Sets the parameters of the shared resource.

uint32 SetShareInfo(
    [in] uint32 MaximumAllowed,
    [in] string Description,
    [in] Win32_SecurityDescriptor Access
);

Parameters

ParameterTypeDirectionDescription
MaximumAlloweduint32in

Limit on the maximum number of users allowed to use this resource concurrently.

Descriptionstringin

Describes the resource being shared.

AccessWin32_SecurityDescriptorin

Security descriptor for user-level permissions. A security descriptor contains information about the permission, owner, and access capabilities of the resource. For more information, see Win32_SecurityDescriptor.

Call the SetShareInfo 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_ClusterShare -Filter "Name = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'SetShareInfo'
    Arguments   = @{
        MaximumAllowed = 0
        Description    = 'Example'
        Access         = $null
    }
    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.

Inheritance

Superclass chain

  1. CIM_ManagedSystemElement
  2. CIM_LogicalElement
  3. Win32_Share
  4. Win32_ClusterShare

Known subclasses

No known subclass.

Requirements

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

Dynamic Provider("CIMWin32") UUID("{8502C4D6-5FBB-11D2-AAC1-006008C78BC7}") SupportsCreate CreateBy("Create") SupportsDelete DeleteBy("DeleteInstance") 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.