Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How does one do the following things with IIS 5.1/6.0 using PowerShell:

  • Enable HTTP Compression
  • Set GZIP and DEFLATE file extensions
  • Enable Dynamic and Static compression for GZIP and DEFLATE
  • Set the compression lvl

Any pointers to tutorials on this would be appreciated as I have yet to come across any that explain how to do this programmatically.

share|improve this question

2 Answers 2

Your initial line of attack with PowerShell is to use WMI. Unfortunately, the root\MicrosoftIisV2 namespace is set up with non-standard security settings which you can't change in PS (not in V1, at least, V2 may be different).

I would suggest looking at the IIS ADSI provider, specifically the IIsCompressionScheme object - http://msdn.microsoft.com/en-us/library/ms524574.aspx

You may be able to work with this in PowerShell by manipulating

$obj = [ADSI]"IIS://MachineName/W3SVC/Filters/Compression/Scheme"

However, ADSI is pretty evil, so you'll have a fairly steep learning curve.

share|improve this answer

Metabase Explorer lets you set these values. You can automate setting values by linking against IISMbLib.dll, as a post of mine to StackOverflow explains.

You could do something similar with this, or you could use the ADSI namespace as owenevans00 says.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.