Modify the properties of an SMB share.
Syntax Set-SmbShare [-Name] String[] [[-ScopeName] String[]] [-SmbInstance SmbInstance] [-Description String] [-ConcurrentUserLimit UInt32] [-CATimeout UInt32] [-ContinuouslyAvailable Boolean] [-FolderEnumerationMode FolderEnumerationMode] [-CachingMode CachingMode] [-SecurityDescriptor String] [-EncryptData Boolean] [-CompressData Boolean] [-LeasingMode LeasingMode] [-Force] [-CimSession CimSession[] [-ThrottleLimit Int32] [-AsJob] [-PassThru] [-WhatIf] [-Confirm] [CommonParameters] Set-SmbShare -InputObject CimInstance[] [-Description String] [-ConcurrentUserLimit UInt32] [-CATimeout UInt32] [-ContinuouslyAvailable Boolean] [-FolderEnumerationMode FolderEnumerationMode] [-CachingMode CachingMode] [-SecurityDescriptor String] [-EncryptData Boolean] [-CompressData Boolean] [-LeasingMode LeasingMode] [-Force] [-CimSession CimSession[] [-ThrottleLimit Int32] [-AsJob] [-PassThru] [-WhatIf] [-Confirm] [CommonParameters] Key -AsJob Run the cmdlet as a background job. Use this parameter to run commands that take a long time to complete. -CachingMode Specify the caching mode of the offline files for the SMB share. There are five caching modes: None Prevent users from storing documents and programs offline. Manual Allow users to identify the documents and programs that they want to store offline. Programs Automatically store documents and programs offline. Documents Automatically store documents offline. BranchCache Enable BranchCache and manual caching of documents on the shared folder. -CATimeout The continuous availability time-out of the SMB share. -CimSession Run the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of New-CimSession or Get-CimSession. The default is the current session on the local computer. -CompressData Indicate that the shares being enumerated should request compression from clients. -ConcurrentUserLimit The maximum number of concurrently connected users that the SMB share may accommodate. If this parameter is set to zero (0), then the number of users is unlimited. By default, new SMB shares have no limit on the number of concurrent connections. -Confirm Prompt for confirmation before running the cmdlet. -ContinuouslyAvailable Indicate that the shares being enumerated should be continuously available. (SMB Transparent Failover setup in Windows Failover Clustering configuration). -Description An optional description of the SMB share. A description of the share can be displayed by running Get-SmbShare. Specify an empty string to clear the current description. Max length = 256 characters. -EncryptData Indicate that the share being enumerated is encrypted. -FolderEnumerationMode Which files and folders in the new SMB share will be visible to the users. Accepted values: AccessBased SMB does not the display the files and folders for a share to a user unless that user has rights to access the files and folders. By default, access-based enumeration is disabled for new SMB shares. Unrestricted Display files and folders to a user even if the user does not have access permission to them. -Force Forces the command to run without asking for user confirmation. -InputObject The input object that is used in a pipeline command. -LeasingMode Specifies SMB leasing and oplock behaviors for application compatibility. Accepted values: Full Use default lease and oplock behaviors from SMB3. Shared Grant read-caching lease but not write or handle-caching. None No oplocks or leases, behave like SMB1 (not recommended). -Name The name of one or more SMB shares to modify. -PassThru Return an object representing the item with which you are working. By default, this cmdlet does not generate any output. -ScopeName The scope name of the SMB share. -SecurityDescriptor The security descriptor for the SMB share in string format. -SmbInstance The input to this cmdlet. You can use this parameter, or you can pipe the input to this cmdlet. Accepted values: Default, CSV, SBL, SR -ThrottleLimit Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If this parameter is omitted or a value of 0 is entered, then PowerShell calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer. -WhatIf Shows what would happen if the cmdlet runs. The cmdlet is not run.
This cmdlet returns a MSFT_SmbShare object that represents the modified share.
Modify properties of an SMB share:
PS C:\> Set-SmbShare -Name "VMFiles" -EncryptData $True
Confirm
Are you sure you want to perform this action?
Performing operation 'Modify' on Target 'Contoso-SO,VMFiles'.
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
Modify properties of an SMB share without confirmation:
PS C:\> Set-SmbShare -Name "VMFiles" -EncryptData $True -Force
Access Based Enumeration can be enabled or disabled with PowerShell:
Get-SmbShare "Share64" | Set-SmbShare -FolderEnumerationMode AccessBased
Get-SmbShare "Share64" | Set-SmbShare -FolderEnumerationMode Unrestricted
This can also be set using the GUI on the server:
Server Manager ➞ File and Storage Services ➞ Shares ➞ choose a shared folder
➞ Right-click ➞ Properties ➞ Enable access-based enumeration.
"There is no joy in possession without sharing" ~ Erasmus
DFSUTIL property abe enable \\ namespace_root - Enable access-based enumeration on DFS.
Get-SmbShare - Retrieve the SMB shares on the computer.
New-SmbShare - Create an SMB share.
Get-SmbShareAccess - Retrieve the ACL of an SMB share.
Grant-SmbShareAccess - Add an allow ACE for a trustee to the security descriptor of the SMB share.