Use Appcmd to set IIS compression level

Here are a few commands to set properties on IIS compression.   


‘This was run from cmd.exe
c:windowssystem32inetsrvappcmd set config -section:urlCompression /doDynamicCompression:true
c:windowssystem32inetsrvappcmd set config -section:system.webServer/httpCompression -[name=’gzip’].dynamicCompressionLevel:9
c:windowssystem32inetsrvappcmd set config /section:httpCompression -directory:E:DataIISTemporaryCompressedFiles -maxDiskSpaceUsage:100 -minFileSizeForComp:256
icacls E:DataIISTemporaryCompressedFiles /grant “NT AuthorityAuthenticated Users:(OI)(CI)(M)”


This was run from Powershell.  Note the slight syntax difference.
c:windowssystem32inetsrvappcmd set config /section:urlCompression /doDynamicCompression:true
c:windowssystem32inetsrvappcmd set config /section:system.webServer/httpCompression -[name=”‘gzip’”].dynamicCompressionLevel:9
c:windowssystem32inetsrvappcmd set config /section:httpCompression /directory:E:DataIISTemporaryCompressedFiles /maxDiskSpaceUsage:100 /minFileSizeForComp:256
icacls E:DataIISTemporaryCompressedFiles /grant “NT AuthorityAuthenticated Users:(OI)(CI)(M)”


Properties on the httpCompression section
ERROR ( message:-sendCacheHeaders
-expiresHeader
-cacheControlHeader
-directory
-doDiskSpaceLimiting
-maxDiskSpaceUsage
-minFileSizeForComp
-noCompressionForHttp10
-noCompressionForProxies
-noCompressionForRange
-staticCompressionDisableCpuUsage
-staticCompressionEnableCpuUsage
-dynamicCompressionDisableCpuUsage
-dynamicCompressionEnableCpuUsage
-staticTypes.[mimeType=’string’].mimeType
-staticTypes.[mimeType=’string’].enabled
-dynamicTypes.[mimeType=’string’].mimeType
-dynamicTypes.[mimeType=’string’].enabled
-[name=’string’].name
-[name=’string’].doStaticCompression
-[name=’string’].doDynamicCompression
-[name=’string’].dll
-[name=’string’].staticCompressionLevel
-[name=’string’].dynamicCompressionLevel
 )


Side note.  I ran into some ‘slight’ syntax issues when running appcmd in Powershell 1.0.  I needed to change the dashes “-” to slashes “/”.   I suppose we’ll look at using the Powershell provider one day,

3 thoughts on “Use Appcmd to set IIS compression level

  1. Jenny

    OR you could simplify by using the compression products from Port80Software[dot]com
    Free trials of httpZip and ZipEnable for IIS are available!

    Jenny

  2. steve schofield

    They could do that also. :) For basic compression (both static and dynamic) IIS 7.0 compression works fine. Is there a comparison between the port 80 software and the built-in IIS stuff?

Comments are closed.