Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Win32_Share class

The Win32_Share class represents a shared resource on a computer system running Windows. This may be a disk drive, printer, interprocess communication, or other sharable device. For more information about retrieving WMI classes, see Retrieving a Class.

The following syntax is simplified from Managed Object Format (MOF) code and includes all of the inherited properties. Properties and methods are in alphabetic order, not MOF order.


[Provider("CIMWin32")]class Win32_Share : CIM_LogicalElement
  uint32   AccessMask;
  boolean  AllowMaximum;
  string   Caption;
  string   Description;
  datetime InstallDate;
  uint32   MaximumAllowed;
  string   Name;
  string   Path;
  string   Status;
  uint32   Type;


The Win32_Share class has these types of members:


The Win32_Share class has these methods.


Class method that initiates sharing for a server resource.


Class method that deletes a share name from a server's list of shared resources, disconnecting connections to the shared resource.


Returns the access rights to the share held by the user or group on whose behalf the instance is returned. You should use this method in place of the AccessMask property, which is always NULL.


Class method that sets the parameters of a shared resource.



The Win32_Share class has these properties.

Data type: uint32
Access type: Read-only

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.

Data type: boolean
Access type: Read-only

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

Data type: string
Access type: Read-only

Short description of the object.

Data type: string
Access type: Read-only

Description of the object.

Data type: datetime
Access type: Read-only

Object was installed. This property does not need a value to indicate that the object is installed.

Data type: uint32
Access type: Read-only

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.

Data type: string
Access type: Read-only
Qualifiers: Key

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

Windows 2003 example: "public"

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

Data type: string
Access type: Read-only

Local path of the Windows share.

Example: "C:\Program Files"

Data type: string
Access type: Read-only

Current status of the object. Various operational and nonoperational statuses can be defined. Operational statuses include: "OK", "Degraded", and "Pred Fail" (an element, such as a SMART-enabled hard disk drive, may be functioning properly but predicting a failure in the near future). Nonoperational statuses include: "Error", "Starting", "Stopping", and "Service". The latter, "Service", could apply during mirror-resilvering of a disk, reload of a user permissions list, or other administrative work. Not all such work is online, yet the managed element is neither "OK" nor in one of the other states.

The values are:

"Pred Fail"
Data type: uint32
Access type: Read-only

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

0 (0x0)

Disk Drive

1 (0x1)

Print Queue

2 (0x2)


3 (0x3)


2147483648 (0x80000000)

Disk Drive Admin

2147483649 (0x80000001)

Print Queue Admin

2147483650 (0x80000002)

Device Admin

2147483651 (0x80000003)

IPC Admin



The Win32_Share class is derived from CIM_LogicalElement.

The Create method in this class is a static method. The Delete, GetAccessMask and SetShareInfo methods are all instance methods.

Depending on your security permissions, you may not be able to retrieve all of the properties of this class. For example, AllowMaximum, MaximumAllowed, Path, and Type properties may return null. Generally speaking, Power Users and Administrators will be able to retrieve all property values.


The following Script Centercode example lists all shares on a computer, and list all the share permissions for each share.

The Get Share Information similar to Win32_Share PowerShell sample queries Win32_Share and provides the results.

The following PowerShell sample displays the shares on the local system.

$shares = Get-WMIObject -class Win32_share
"Shares on : {0}" -f $((gwmi win32_computersystem).name)
$shares | sort name | ft -auto

Alternately, if you wish to filter more precisely, you can use the following PowerShell snippet:

gwmi -q "SELECT * FROM Win32_Share WHERE Name != 'ADMIN$' AND Name != 'IPC$'"

The Following VBScript sample displays the shares on the local system.

strComputer = "." 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Share")

For Each objItem in colItems 
 Wscript.Echo "Name: " & objItem.Name
 Wscript.Echo "Caption: " & objItem.Caption & "=" & objItem.Path


Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2003







See also

Operating System Classes
WMI Tasks: Files and Folders



© 2015 Microsoft