次の方法で共有


CreateShare method of the MSFT_SmbShare class

Creates a new share and allows the creator to specify initial access rights that determine who can and can t access the newly created share.

Syntax

uint32 CreateShare(
  [in]  string        Name,
  [in]  string        ScopeName,
  [in]  string        Path,
  [in]  string        Description,
  [in]  uint32        ConcurrentUserLimit,
  [in]  uint32        FolderEnumerationMode,
  [in]  uint32        CachingMode,
  [in]  boolean       Temporary,
  [in]  boolean       ContinuouslyAvailable,
  [in]  uint32        CATimeout,
  [in]  boolean       EncryptData,
  [in]  string        FullAccess[],
  [in]  string        ChangeAccess[],
  [in]  string        ReadAccess[],
  [in]  string        NoAccess[],
  [in]  string        SecurityDescriptor,
  [out] MSFT_SmbShare CreatedShare
);

Parameters

Name [in]

Name of the share.

ScopeName [in]

Name of the endpoint to which the share is scoped.

Path [in]

Absolute path to the file system directory that is shared. Null if the share is not a file share.

Description [in]

Optional description of the share.

ConcurrentUserLimit [in]

Maximum number of users that may concurrently access the share. If this property is zero, there is no limit.

FolderEnumerationMode [in]

The enumeration mode that is enabled for the share.

AccessBased (0)

Access-based

Unrestricted (1)

Unrestricted

CachingMode [in]

The caching policy for the share.

None (0)

Manual (1)

Documents (2)

Programs (3)

BranchCache (4)

Unknown (5)

Temporary [in]

Indicates whether this is a temporary share.

ContinuouslyAvailable [in]

Indicates whether the share supports continuous availability.

CATimeout [in]

In case of a failover, the number of seconds the client will wait before failing the operation.

EncryptData [in]

Indicates whether the data on the share should be encrypted.

FullAccess [in]

An array of strings containing the account names of users to be granted full access to the share.

ChangeAccess [in]

An array of strings containing the account names of users to be granted change access to the share.

ReadAccess [in]

An array of strings containing the account names of users to be granted read-only access to the share.

NoAccess [in]

An array of strings containing the account names of users to be granted no access to the share.

SecurityDescriptor [in]

The name of the security descriptor of the share.

Windows Server 2012 and Windows 8: This parameter is not supported before Windows Server 2012 R2 and Windows 8.1.

CreatedShare [out]

An instance of the MSFT_SmbShare class that represents the share.

Requirements

Minimum supported client
Windows 8
Minimum supported server
Windows Server 2012
Namespace
Root\Microsoft\Windows\Smb
Header
Shobjidl_core.h
MOF
SmbWmiV2.mof
DLL
SmbWmiV2.dll

See also

MSFT_SmbShare

NetShareAdd