Using SMB compression under Windows Server 2022 and Windows 11

To support me, you can subscribe to the channel, share and like the videos, disable your ad blocker or make a donation. Thank you!

Bonjour,

Use SMB compression in Windows Server 2022 and Windows 11 to reduce data transfer times on network shares.

Commands used in the SMB compression demonstration video

Microsoft documentation : https://docs.microsoft.com/en-us/windows-server/storage/file-server/smb-compression

$source = 'C:\compression_smb'
$share = '\\server\share_name'
# Create a 10 GB virtual disk for the demo
# Requires the hyper-v module
New-VHD $source\smb_demo.vhdx -Fixed -SizeBytes 10gb
# Use Robocopy.exe without SMB compression
ROBOCOPY $source $share *.vhdx
# Use Robocopy.exe to request SMB compression with /COMPRESS
ROBOCOPY $source $share *.vhdx /COMPRESS
# Create a share that always requires SMB compression
New-SmbShare -Name share -Path d:\share -CompressData $true
# Enable the default SMB compression request for an existing share
Set-SmbShare -Name share -CompressData $true
# Request SMB compression on mapped drives
# New-SMBMapping with -CompressNetworkTraffic $true.
New-SmbMapping -LocalPath Z: -RemotePath $share -CompressNetworkTraffic $true
# Map a drive using NET USE /REQUESTCOMPRESSION:YES.
NET USE * $share /REQUESTCOMPRESSION:YES
# Use Robocopy.exe to request SMB compression using /COMPRESS
ROBOCOPY $source $share *.vhdx /COMPRESS
# Use Xcopy.exe to request SMB compression with /COMPRESS
XCOPY $source\*.vhdx $share\* /COMPRESS
# Always compress (SMB client)
Set-ItemProperty -Path HKLM:\System\CurrentControlSet\ServicesLanmanWorkstation\Parameters `
-name EnableCompressedTraffic -value 1
# No restart is required.
# Ignore all compression requests (SMB client)
Set-SMbClientConfiguration -DisableCompression $true
# or
Set-ItemProperty -Path HKLM:\System\CurrentControlSet\Services\LanmanWorkstation\Parameters ` -name DisableCompression -value $true # or
-name DisableCompression -value 1
# No restart is required.
# Ignore all compression requests (SMB server)
Set-ItemProperty -Path HKLM:\System\CurrentControlSet\Services\LanmanServer\Parameters `
-name DisableCompression -value 1
# No restart is necessary.
# Always compress whatever the file size (Tries to compress the 4 1st GB of the file, if 1 byte is compressible, compresses the rest of the file).
Set-ItemProperty -Path HKLM\System\CurrentControlSet\Services\LanmanWorkstation\Parameters `
-name CompressibilitySamplingSize -value 4294967295
Set-ItemProperty -Path HKLM\System\CurrentControlSet\ServicesLanmanWorkstationParameters `
-name CompressibleThreshold -value 0

Video : Using SMB compression under Windows Server 2022 and Windows 11

Related links