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.
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