简体   繁体   English

PowerShell - 访问根 web.config

[英]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.我似乎找不到访问根 web.config 的好提示,当前位于 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.在我的情况下,我想应用一些安全设置来级联到应用程序(例如:禁用会话状态/压缩),理想情况下我会在 PowerShell DSC 中使用 xWebConfigProperty 或可能的原始 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).如果有人有办法检索这个(必须使用旧的 WebAdministration 模块),我会很感激(或者只是验证我需要更有机的东西,比如将 gci 路径转换为 ​​xml 进行操作)。

Changes applied to root web.config using 'MACHINE/WEBROOT'.使用“MACHINE/WEBROOT”将更改应用于根 web.config。

You can test with something like: Get-WebConfigurationProperty -pspath 'MACHINE/WEBROOT' -name "mode" -filter "system.web/sessionState"您可以使用以下内容进行测试: Get-WebConfigurationProperty -pspath 'MACHINE/WEBROOT' -name "mode" -filter "system.web/sessionState"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM