How to run appCmd in PowerShell to add custom headers to the Default Web Site
Try it like this:
$env:defaultWebSite = "Default Web Site"$appCmd = "C:\windows\system32\inetsrv\appcmd.exe"& $appCmd --% set config "%defaultWebSite%" -section:system.webServer/httpProtocol /+customHeaders.[name='P3P',value='policyRef="/w3c/p3p.xml",CP="DSP COR NID OUR COM PRE"']
If you use any variables after the --%
the have to be environment variables.