New-SmbShare is a Windows PowerShell command that enables users to create and manage Server Message Block (SMB) file shares on computers running Windows Server. This command is used to create a new SMB file share on a server, configure access permissions, and set other properties for the share. It is important to understand the syntax, parameters, inputs, outputs, examples, and tips for using this command in order to properly create and manage SMB file shares.

Syntax of New-SmbShare Command

The syntax of the New-SmbShare command is as follows:

New-SmbShare [-Name] [-Path] [-FullAccess] [-ChangeAccess] [-ReadAccess] [-Description] [-ContinuouslyAvailable] [-CachingMode] [-EncryptData] [-Force] [-Guid] [-ScopeName] [-ShadowCopy] [-ShadowCopyMode] [-ShadowCopyStorage] [-ShareState] [-TimeOut] [-WhatIf] [-Confirm]

Parameters of New-SmbShare Command

The parameters of the New-SmbShare command are as follows:

Parameter Description
Name Specifies the name of the SMB file share.
Path Specifies the path of the folder to be shared.
FullAccess Specifies the users and groups that have full access to the share.
ChangeAccess Specifies the users and groups that have change access to the share.
ReadAccess Specifies the users and groups that have read access to the share.
Description Specifies a description of the share.
ContinuouslyAvailable Specifies whether the share is continuously available.
CachingMode Specifies the caching mode for the share.
EncryptData Specifies whether data is encrypted when written to the share.
Force Specifies whether to overwrite an existing share.
Guid Specifies a unique identifier for the share.
ScopeName Specifies the name of the scope for the share.
ShadowCopy Specifies whether shadow copies are enabled for the share.
ShadowCopyMode Specifies the shadow copy mode for the share.
ShadowCopyStorage Specifies the storage location for the shadow copies.
ShareState Specifies the state of the share.
TimeOut Specifies the timeout period for the share.
WhatIf Specifies whether to simulate the command.
Confirm Specifies whether to prompt the user for confirmation.

Inputs of New-SmbShare Command

The inputs of the New-SmbShare command are as follows:

  • Name
  • Path
  • FullAccess
  • ChangeAccess
  • ReadAccess
  • Description
  • ContinuouslyAvailable
  • CachingMode
  • EncryptData
  • Force
  • Guid
  • ScopeName
  • ShadowCopy
  • ShadowCopyMode
  • ShadowCopyStorage
  • ShareState
  • TimeOut
  • WhatIf
  • Confirm

Outputs of New-SmbShare Command

The outputs of the New-SmbShare command are as follows:

  • SMB file share
  • Access permissions
  • Other properties

Examples of New-SmbShare Command

The following are examples of how to use the New-SmbShare command:

  • To create a new SMB file share with full access for the user “John”, use the following command:

    New-SmbShare -Name “MyShare” -Path “C:\MyShare” -FullAccess “John”

  • To create a new SMB file share with read access for the group “Marketing”, use the following command:

    New-SmbShare -Name “MarketingShare” -Path “C:\MarketingShare” -ReadAccess “Marketing”

  • To create a new SMB file share with change access for the user “Jane” and the group “Accounting”, use the following command:

    New-SmbShare -Name “AccountingShare” -Path “C:\AccountingShare” -ChangeAccess “Jane”,”Accounting”

Tips for Using New-SmbShare Command

When using the New-SmbShare command, it is important to keep the following tips in mind:

  1. Make sure to specify the correct path for the share.
  2. Be sure to specify the correct access permissions for the share.
  3. If the share already exists, use the -Force parameter to overwrite it.
  4. If the share is continuously available, use the -ContinuouslyAvailable parameter to enable it.
  5. If shadow copies are enabled for the share, use the -ShadowCopy parameter to enable them.
  6. If data is to be encrypted when written to the share, use the -EncryptData

Leave a Reply