Skip to content

Instantly share code, notes, and snippets.

@donaldgray
donaldgray / setHeader.ps1
Created November 7, 2016 09:16
Powershell script for setting IIS header
$PSPath = 'MACHINE/WEBROOT/APPHOST/' + $WebsiteName
$Filter = 'system.webServer/httpProtocol/customHeaders'
# Ensure working with IIS 7 and 7.5(+?)
try {
Add-PSSnapin WebAdministration
}
catch {
try {
Import-Module WebAdministration