Share via


CreateFileShare method of the MSFT_SMFileServer class

Creates a file share.

Syntax

UInt32 CreateFileShare(
  [in]            MSFT_SMFileSystem REF fileSystem,
  [in]            String                Name,
  [in]            UInt16                FileSharingProtocol,
  [in]            Boolean               IsContinuouslyAvailable,
  [in]            Boolean               EncryptData,
  [in]            Boolean               RunAsJob,
  [out]           MSFT_SMFileShare  REF CreatedFileShare,
  [out]           MSFT_SMJob        REF CreatedStorageJob,
  [out, optional] MSFT_SMExtendedStatus ExtendedStatus
);

Parameters

fileSystem [in]

The pool or volume on which the share is created.

Name [in]

A human-readable string used to identify a file share. This name must be unique within the scope of the owning file server.

FileSharingProtocol [in]

The file sharing protocol used by the share.

The possible values are.

NFS (2)

SMB (3)

IsContinuouslyAvailable [in]

If True the share is continuously available.

EncryptData [in]

If True the share is encrypted.

RunAsJob [in]

If True, start a job to create the file share asynchronously.

CreatedFileShare [out]

The MSFT_SMFileShare object created by calling this method.

CreatedStorageJob [out]

Reference to the MSFT_SMJob instance. May be NULL if the job is completed.

ExtendedStatus [out, optional]

An MSFT_SMExtendedStatus object containing the results of calling this method.

Return value

Success (0)

Not Supported (1)

Unspecified Error (2)

Timeout (3)

Failed (4)

Invalid Parameter (5)

Method Parameters Checked - Job Started (4096)

Size Not Supported (4097)

Access denied (40001)

There are not enough resources to complete the operation. (40002)

An unexpected I/O error has occurred (42002)

The requested access path is already in use. (42007)

Requirements

Minimum supported client
None supported
Minimum supported server
Windows Server 2016
Namespace
Root\Microsoft\Windows\Storage\SM
MOF
MsftStrgMan.mof
DLL
StorageService.dll

See also

MSFT_SMFileServer