Set SmbServerConfiguration - PowerShell


Overview

The Set-SmbServerConfiguration command modifies the configuration settings of the Server Message Block (SMB) server on the local computer. This command allows administrators to configure various SMB settings related to security, performance, and compatibility.

Syntax

Set-SmbServerConfiguration [[-EnableSMB2] <Boolean>] [[-EnableSMB1] <Boolean>] [-SMB1EncryptionOnly <Boolean>] [-SMB2Encryption <Boolean>] [[-SMB2SigningRequired] <Boolean>] [[-SMB2EncryptionRequired] <Boolean>] [[-HideUnencryptedShares] <Boolean>] [[-AllowSMB1GuestAccess] <Boolean>] [[-MaxLogFileSize] <UInt32>] [[-MaxLogEntries] <UInt32>] [[-MaxHistoryEntries] <UInt32>] [[-JumboFrames] <Boolean>] [[-LogPath] <String>]

Options/Flags

  • -EnableSMB2: Enables the SMB 2 protocol on the SMB server. Default: True
  • -EnableSMB1: Enables the SMB 1 protocol on the SMB server. Default: False
  • -SMB1EncryptionOnly: Restricts SMB 1 connections to use only encrypted communication. Default: True
  • -SMB2Encryption: Enables encryption for SMB 2 connections. Default: False
  • -SMB2SigningRequired: Requires signing for SMB 2 connections. Default: False
  • -SMB2EncryptionRequired: Requires encryption for SMB 2 connections. Default: False
  • -HideUnencryptedShares: Hides unencrypted shares from clients that do not support encryption. Default: False
  • -AllowSMB1GuestAccess: Allows guest access to SMB 1 shares. Default: False
  • -MaxLogFileSize: Specifies the maximum size (in bytes) for the SMB server log file. Default: 10 MB
  • -MaxLogEntries: Specifies the maximum number of entries in the SMB server log. Default: 100
  • -MaxHistoryEntries: Specifies the maximum number of history entries for SMB 2 decryption failures. Default: 10
  • -JumboFrames: Enables the use of jumbo frames for SMB 2 connections. Default: False
  • -LogPath: Specifies the path to the SMB server log file. Default: %SystemRoot%\System32\LogFiles\SmbSrv\SmbSrv.log

Examples

Enable SMB 2 and disable SMB 1:

Set-SmbServerConfiguration -EnableSMB2 -EnableSMB1 $false

Configure SMB 1 with encryption only:

Set-SmbServerConfiguration -EnableSMB1 -SMB1EncryptionOnly

Set the SMB server log file size and path:

Set-SmbServerConfiguration -MaxLogFileSize 20MB -LogPath C:\SMBServerLogs\SmbSrv.log

Common Issues

  • Clients cannot connect to the SMB server: Ensure that SMB is enabled on both the server and client, and that the correct ports are open in the firewall.
  • SMB 1 connections are not encrypted: Verify that SMB1EncryptionOnly is set to True and that the client supports SMB 1 encryption.
  • SMB 2 connections are slow: Enable jumbo frames on both the server and client to improve performance.

Integration

The Set-SmbServerConfiguration command can be combined with other PowerShell commands to automate SMB server management tasks. For example, you can use the Get-SmbServerConfiguration command to retrieve the current configuration and compare it with a desired configuration.

  • Get-SmbServerConfiguration
  • Enable-SmbShare
  • Disable-SmbShare