SetShareInfo method of the Win32_Share Class
Applies to: desktop apps only
The SetShareInfo WMI class method sets the parameters of a shared resource. Only members of the Administrators or Account Operators local group or those with Communication, Print, or Server operator group membership can successfully execute SetShareInfo. The print operator can only set printer queues. The Communication operator can only set communication device queues.
This topic uses Managed Object Format (MOF) syntax. For more information about using this method, see Calling a Method.
Syntax
uint32 SetShareInfo( [in] uint32 MaximumAllowed, [in, optional] string Description, [in] Win32_SecurityDescriptor Access );
Parameters
- MaximumAllowed [in]
-
Limit on the maximum number of users allowed to use this resource concurrently.
Example: 10. This parameter is optional.
- Description [in, optional]
-
Optional comment to describe the resource being shared.
- Access [in]
-
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.
Return value
| Return code | Description |
|---|---|
|
Success |
|
Access Denied |
|
Unknown Failure |
|
Invalid Name |
|
Invalid Level |
|
Invalid Parameter |
|
Duplicate Share |
|
Redirected Path |
|
Unknown Device or Directory |
|
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 |
|
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 SetShareINfo method is a dynamic 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