GetAccessMask method of the Win32_Share Class
Applies to: desktop apps only
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 |
|---|---|
|
Grants the right to read data from the file. For a directory, this value grants the right to list the contents of the 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. |
|
Grants the right to append data to the file. For a directory, this value grants the right to create a subdirectory. |
|
Grants the right to read extended attributes. |
|
Grants the right to write extended attributes. |
|
Grants the right to execute a file. For a directory, the directory can be traversed. |
|
Grants the right to delete a directory and all of the files it contains (its children), even if the files are read-only. |
|
Grants the right to read file attributes. |
|
Grants the right to change file attributes. |
|
Grants delete access. |
|
Grants read access to the security descriptor and owner. |
|
Grants write access to the discretionary access control list (DACL). |
|
Assigns the write owner. |
|
Synchronizes access and allows a process to wait for an object to enter the signaled state. |
Examples
For more information and script code examples, see WMI Tasks for Scripts and Applications and the TechNet ScriptCenter Script Repository.
For more information and C++ code examples, see WMI C++ Application 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.
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 XP |
|---|---|
|
Minimum supported server | Windows Server 2003 |
|
Namespace |
\root\CIMV2 |
|
MOF |
|
|
DLL |
|
See also
Send comments about this topic to Microsoft
Build date: 3/9/2012
The documentation does not make it clear, but the GetAccessMask method is an object method and is used on an occurance of this class. You can see this with PowerShell as follows:
PS c:\foo:\> Get-WMIOBjecct Win32_share | get-member
TypeName: System.Management.ManagementObject#root\cimv2\Win32_Share
Name MemberType Definition
---- ---------- ----------
Delete Method System.Management.ManagementBaseObject Delete()
GetAccessMask Method
System.Management.ManagementBaseObject GetAccessMask()
SetShareInfo Method System.Management.ManagementBaseObject SetShareInfo(System.UInt32 MaximumAllowed, System.String Descr...
AccessMask Property System.UInt32 AccessMask {get;set;}
AllowMaximum Property System.Boolean AllowMaximum {get;set;}
Caption Property System.String Caption {get;set;}
Description Property System.String Description {get;set;}
InstallDate Property System.String InstallDate {get;set;}
MaximumAllowed Property System.UInt32 MaximumAllowed {get;set;}
Name Property System.String Name {get;set;}
Path Property System.String Path {get;set;}
Status Property System.String Status {get;set;}
Type Property System.UInt32 Type {get;set;}
__CLASS Property System.String __CLASS {get;set;}
__DERIVATION Property System.String[] __DERIVATION {get;set;}
__DYNASTY Property System.String __DYNASTY {get;set;}
__GENUS Property System.Int32 __GENUS {get;set;}
__NAMESPACE Property System.String __NAMESPACE {get;set;}
__PATH Property System.String __PATH {get;set;}
__PROPERTY_COUNT Property System.Int32 __PROPERTY_COUNT {get;set;}
__RELPATH Property System.String __RELPATH {get;set;}
__SERVER Property System.String __SERVER {get;set;}
__SUPERCLASS Property System.String __SUPERCLASS {get;set;}
PSStatus PropertySet PSStatus {Status, Type, Name}
ConvertFromDateTime ScriptMethod System.Object ConvertFromDateTime();
ConvertToDateTime ScriptMethod System.Object ConvertToDateTime();
- 5/19/2009
- Thomas Lee