NIK_77
NIK_77

Reputation: 21

IIS output caching setting using PowerShell

I have been trying to find a way to configure the IIS 'outputcaching' setting. I have been looking around and having really had anything that works. I am basically trying to set output caching for an extension .pdf and the setting "until changed".

I've tried this code:

Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST/Default Web 
Site' -Filter "system.webServer/caching/profiles/add[@extension='.pdf']" -
Name "kernelCachePolicy" -Value "CacheUntilChange"

but that gave me the following error:

WARNING: Target configuration object 'system.webServer/caching/profiles/add[@extension='.pdf'] is not found at path 'MACHINE/WEBROOT/APPHOST/Default Web Site'.

Upvotes: 2

Views: 844

Answers (1)

ArcSet
ArcSet

Reputation: 6860

Try using Add-WebConfigurationProperty

Add-WebConfigurationProperty Will add a property that isn't there.

Set-WebConfigurationProperty Changes the value of a property that already exists

Upvotes: 0

Related Questions