web-configiis-8.5powershell-5.1

PowerShell - Accessing root web.config


I can't seem to find a good hint on accessing the root web.config, currently in C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config. In my situation, I want to apply a few security settings to cascade down to apps (ex: disable sessionstate/compression) where ideally I'd do this in PowerShell DSC using xWebConfigProperty, or possibly raw PowerShell. If anyone has a means to retrieve this (have to use the older WebAdministration module), I'd appreciate it (or just verifying I need something more organic like gci path into xml for manipulation).


Solution

  • Changes applied to root web.config using 'MACHINE/WEBROOT'.

    You can test with something like: Get-WebConfigurationProperty -pspath 'MACHINE/WEBROOT' -name "mode" -filter "system.web/sessionState"