The
Create WMI class method initiates sharing for a server resource. Only members of the Administrators or Account Operators local group or those with Communication, Print, or Server operator group membership can successfully execute
Create. The Print operator can only add printer queues. The Communication operator can only add communication device queues.
This topic uses Managed Object Format (MOF) syntax. For more information about using this method, see
Calling a Method.
Syntax
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
- Path [in]
-
Local path of the Windows share.
Example, "C:\Program Files".
- Name [in]
-
Passes the alias to a path set up as a share on a computer system running Windows.
Example, "public".
- Type [in]
-
Passes the type of resource being shared. Types includes disk drives, print queues, interprocess communications (IPC), and general devices. Can be one of the following values.
| Value | Meaning |
- 0 (0x0)
| Disk Drive
|
- 1 (0x1)
| Print Queue
|
- 2 (0x2)
| Device
|
- 3 (0x3)
| IPC
|
- 2147483648 (0x80000000)
| Disk Drive Admin
|
- 2147483649 (0x80000001)
| Print Queue Admin
|
- 2147483650 (0x80000002)
| Device Admin
|
- 2147483651 (0x80000003)
| IPC Admin
|
- MaximumAllowed [in]
-
Limit on the maximum number of users allowed to concurrently use this resource.
Example: 10. This parameter is optional.
- Description [in]
-
Optional comment to describe the resource being shared. This parameter is optional.
- Password [in]
-
Password (when the server is running with share-level security) for the shared resource. If the server is running with user-level security, this parameter is ignored. This parameter is optional.
- Access [in]
-
Security descriptor for user level permissions. A security descriptor contains information about the permissions, owner, and access capabilities of the resource. If this parameter is not supplied or is NULL, then Everyone has read access to the share. For more information, see
Win32_SecurityDescriptor and Changing Access Security on Securable Objects.
Return Value
Returns one of the values listed in the following table, or any other value to indicate an error.
| Return code | Description |
- 0
| Success
|
- 2
| Access Denied
|
- 8
| Unknown Failure
|
- 9
| Invalid Name
|
- 10
| Invalid Level
|
- 21
| Invalid Parameter
|
- 22
| Duplicate Share
|
- 23
| Redirected Path
|
- 24
| Unknown Device or Directory
|
- 25
| Net Name Not Found
|
Examples
For script code examples, see WMI Tasks for Scripts and Applications and the TechNet ScriptCenter Script Repository.
For C++ code examples, see WMI C++ Application Examples.
Requirements
| Minimum supported client | Windows 2000 Professional |
| Minimum supported server | Windows 2000 Server |
| MOF | Cimwin32.mof |
| DLL | Cimwin32.dll |
| Namespace | \root\cimv2 |
See Also
- Operating System Classes
- Win32_Share
Send comments about this topic to Microsoft
Build date: 11/3/2009