script: iis7 making compression work

This was harder than it should have been, the permissions were wrong on the inetpubtempIIS Temporary Compressed Files folder and it made things difficult to fix. Here’s the script that I wrote. Basically we are setting the directory (probably redundant but I would rather play it safe), making the directory, applying the permission, and then enabling the compression.

You will need to go to a working server and export the permissions and run this first (I could let you have my file, but what admin would download a random file from some dude on the internet and run it? Not me!) Here’s the command that does that:

icacls "c:inetpubtempIIS Temporary Compressed Files" /save cinetpubtempiiscompressedfiles.acl

 

Then place that file with your script and run it on the offending server.

******Script*********

mkdir "C:inetpubtempIIS Temporary Compressed Files"

icacls c:inetpubtemp /restore cinetpubtempiiscompressedfiles.acl

%windir%system32inetsrvappcmd set config -section:system.webServer/httpCompression -directory:"C:inetpubtempIIS Temporary Compressed Files"

%windir%system32inetsrvappcmd set config -section:urlCompression /doDynamicCompression:true

******Script*********

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s