Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

GetAccessMask method of the Win32_Share class

The GetAccessMask method returns a uint32 bitmap with the access rights to the share held by the user or group on whose behalf the instance is returned.

This topic uses Managed Object Format (MOF) syntax. For more information about using this method, see Calling a Method.

Syntax


uint32 GetAccessMask();

Parameters

This method has no parameters.

Return value

Value (const/dec/hex)Description
FILE_LIST_DIRECTORY
1 (0x1)

Grants the right to read data from the file. For a directory, this value grants the right to list the contents of the directory.

FILE_ADD_FILE
2 (0x2)

Grants the right to write data to the file. For a directory, this value grants the right to create a file in the directory.

FILE_ADD_SUBDIRECTORY
4 (0x4)

Grants the right to append data to the file. For a directory, this value grants the right to create a subdirectory.

FILE_READ_EA
8 (0x8)

Grants the right to read extended attributes.

FILE_WRITE_EA
16 (0x10)

Grants the right to write extended attributes.

FILE_TRAVERSE
32 (0x20)

Grants the right to execute a file. For a directory, the directory can be traversed.

FILE_DELETE_CHILD
64 (0x40)

Grants the right to delete a directory and all of the files it contains (its children), even if the files are read-only.

FILE_READ_ATTRIBUTES
128 (0x80)

Grants the right to read file attributes.

FILE_WRITE_ATTRIBUTES
256 (0x100)

Grants the right to change file attributes.

DELETE
65536 (0x10000)

Grants delete access.

READ_CONTROL
131072 (0x20000)

Grants read access to the security descriptor and owner.

WRITE_DAC
262144 (0x40000)

Grants write access to the discretionary access control list (DACL).

WRITE_OWNER
524288 (0x80000)

Assigns the write owner.

SYNCHRONIZE
1048576 (0x100000)

Synchronizes access and allows a process to wait for an object to enter the signaled state.

 

Remarks

GetAccessMask method is an object method and is used on an occurrence of this class.

Examples

The following VBScript code example creates a share folder and then gets the value of the access mask in the security descriptor that secures the share folder.



Const FILE_SHARE = 0
Const MAXIMUM_CONNECTIONS = 4000 
strComputer = "."

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objNewShare = objWMIService.Get("Win32_Share")
Return = objNewShare.Create ("C:\Temp", "TestShare", FILE_SHARE, MAXIMUM_CONNECTIONS, "test share")

If Return <> 0 Then
          WScript.Echo Return
          WScript.Quit
End If

Set objShare = objWMIService.Get("Win32_Share.Name='TestShare'")
Return = objShare.GetAccessMask
WScript.Echo Return

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2003

Namespace

\root\CIMV2

MOF

CIMWin32.mof

DLL

CIMWin32.dll

See also

Win32_Share

 

 

Show:
© 2014 Microsoft