Set SmbShare - PowerShell


Overview

Set-SmbShare modifies the properties of an existing SMB share. Use this command to configure share permissions, access control, and other share settings.

Syntax

Set-SmbShare [-Name] <String> [-Path] <String> [-Description] <String> [-FullAccess [<Security>]*] -ChangeAccess [<Security>]*] -ReadAccess [<Security>]*]

Options/Flags

  • -Name: Specifies the name of the SMB share to modify.
  • -Path: Sets the path to the SMB share.
  • -Description: Provides a description for the SMB share.
  • -FullAccess: Grants full control permissions to specified users or groups.
  • -ChangeAccess: Grants change access permissions to specified users or groups.
  • -ReadAccess: Grants read access permissions to specified users or groups.

Examples

  • Grant full access to all users:
Set-SmbShare -Name Share1 -FullAccess Everyone
  • Grant read access to a specific user:
Set-SmbShare -Name Share2 -ReadAccess "domain\username"
  • Change the description of a share:
Set-SmbShare -Name Share3 -Description "This is a shared folder for project files."

Common Issues

  • Error: The SMB share does not exist: Ensure that the specified share name is correct and that the share exists on the server.
  • Error: Access denied: Verify that you have sufficient permissions to modify the share.

Integration

Use Set-SmbShare with the following commands for advanced tasks:

  • Get-SmbShare: Retrieves information about SMB shares.
  • New-SmbShare: Creates a new SMB share.
  • Remove-SmbShare: Deletes an SMB share.