Microsoft makes an important change around the SMB of Windows 11. It concerns the compression function. It becomes more impactful which reduces the size of the files and consequently the times necessary for the transfer of the data.
Windows 11 and Windows Servers 2022 take advantage of an SMB compression function. SMB is short for Server Message Block. It is a communication protocol supporting the sharing of data and printers. We also find it when browsing networks.
This compression reduces the size of files during a transfer. It avoids manual interventions. There is no need to compress the data first, do the transfer and then decompress everything on the target drive. The advantage of reducing the size of the data to be transferred is to save bandwidth. This is particularly useful with networks with limited speeds such as Wi-Fi or 1 Gbps Ethernet if files of several GB are handled.
Unfortunately, this function respects particular rules which limit its actions and its possibilities. For example Microsoft has implemented a threshold of 100 MB compressible in the first 500 MB of a file. As a result, small files do not benefit from this compression. Similarly large file transfers can suffer if the first 500 MB does not offer this level of compression.
Now this rule no longer applies. SMB compression ignores data size. Clearly all files benefit from a compression request during a transfer. Microsoft says, however, that not all files are “equal” when it comes to compression. Already compressed files, such as images in JPG format or archives in ZIP and RAR formats, do not benefit from this advance.
Windows 11 and SMB compression, details
Users, administrators, and applications can request compression. It is possible to use new policies and PowerShell commands to control this feature.
Microsoft details
Group policy
Computer ConfigurationAdministrative TemplatesNetworkLanman Workstation
- Disable SMB Compression
- Use SMB Compression by Default
Computer ConfigurationAdministrative TemplatesNetworkLanman Server
- Disable SMB Compression
- Request traffic compression for all shares
These all write to the following location and will override the ‘native’ registry settings as usual with group policy:
HKEY_LOCAL_MACHINESOFTWAREPoliciesMicrosoftWindowsLanmanWorkstationparameters
PowerShell for SMB client
Set-SMBClientConfiguration [-EnableCompressibilitySampling ] [-CompressibilitySamplingSize ] [-CompressibleThreshold ] [-DisableCompression ] [-RequestCompression ]
- -DisableCompression $true or $False – never compress even if server or application requested
- -RequestCompression $true or $false – always request compression even if server or application didn’t specify it
- -EnableCompressibilitySampling $true or $false – control legacy sampling behavior
- -CompressibilitySamplingSize 1- 9,007,199,254,740,992 – size in bytes of range to sample in a file looking for compressibility
- -CompressibleThreshold – 1- 9,007,199,254,740,992 – size in bytes of compressible data that must be found within that range
You shouldn’t need to touch the sampling settings without a good reason. Maybe hit me up in the comments first if you’re feeling the urge to touch those. ???? A keen-eyed reader might notice that a range of 9,007,199,254,740,992 is not the Uint64 in the PowerShell. That’s because the real limit in the code is 9PiB, not the 184,467,440,737,095,551,615 bytes of a UInt64 value we had to set in the Posh. If you’ve got individual files bigger than 9 petabytes, I would love to hear your story, regardless!
These values are stored in the registry under:
HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsLanmanWorkstationparameters
Name | Type | Default | Bounds | PS interface (Set-SmbClientConfiguration) |
EnableCompressedTraffic | REG_DWORD | 0 | 0 or 1 | RequestCompression |
DisableCompression | REG_DWORD | 0 | 0 or 1 | DisableCompression |
EnableCompressibilitySampling | REG_DWORD | 0 | 0 or 1 | EnableCompressibilitySampling |
CompressibilitySamplingSize | REG_QWORD | 0 | 0 to 8 PiB | CompressibilitySamplingSize |
CompressibleThreshold | REG_QWORD | 0 | 0 to 8 PiB | CompressibleThreshold |
PowerShell for SMB Server
Set-SmbServerConfiguration [-DisableCompression ] [-RequestCompression ]
- -DisableCompression $true or $False – never compress even if client requested
- -RequestCompression $true or $false – always request compression even if client didn’t specify it
These values are stored in the registry under:
HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsLanmanServerparameters
Name | Type | Default | Bounds | PS interface (Set-SmbServerConfiguration) |
EnableCompressedTraffic | REG_DWORD | 0 | 0 or 1 | RequestCompression |
DisableCompression | REG_DWORD | 0 | 0 or 1 | DisableCompression |
This change will be deployed on Patch Tuesday in September 2022. If you want to take advantage of it now, you can manually trigger the download of the latest optional updates released by Microsoft. It is KB5016693 for Windows Server 2022 and KB5016691 pour Windows 11.