![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | XML processing my web.config file in PowerShell Folks, I'm trying to get the hang of dealing with my web.config files for ASP.NET from PowerShell. Now I can easily load a web.config and all: PS> [xml]$x = ${web.config} PS> $x xml configuration --- ------------- configuration PS> $x.configuration xmlns : http://schemas.microsoft.com/.NetConfiguration/v2.0 configSections : configSections appSettings : appSettings system.web : system.web system.webServer : system.webServer but the tricky question is: how can I access the "system.web" sections where the real meat of the config is?? I can easily get into $x.configuration.configSections, or $x.configuration.appSettings, but no luck with $x.configuration.system.web........ what's the "magic" trick to unlock that??? :-) Thanks! Marc |
My System Specs![]() |
| | #2 (permalink) |
| | Re: XML processing my web.config file in PowerShell Because system.web has a dot, the "web" is treated as a property and there is no "web" element. Try to wrap it with quotation marks and append the child element manually. $x.configuration."system.web".webServices ----- Shay Levi $cript Fanatic http://scriptolog.blogspot.com Hebrew weblog: http://blogs.microsoft.co.il/blogs/scriptfanatic Quote: > Folks, > > I'm trying to get the hang of dealing with my web.config files for > ASP.NET from PowerShell. > > Now I can easily load a web.config and all: > PS>> PS>> $x PS>> Quote: > xml configuration > --- ------------- > configuration PS>> Quote: > xmlns : http://schemas.microsoft.com/.NetConfiguration/v2.0 > configSections : configSections > appSettings : appSettings > system.web : system.web > system.webServer : system.webServer > but the tricky question is: how can I access the "system.web" sections > where the real meat of the config is?? > > I can easily get into $x.configuration.configSections, or > $x.configuration.appSettings, but no luck with > $x.configuration.system.web........ what's the "magic" trick to unlock > that??? :-) > > Thanks! > Marc |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Powershell.exe.config | PowerShell | |||
| Processing xml log files in PowerShell | PowerShell | |||
| Powershell and cmdlet config files | PowerShell | |||
| PowerShell integrated with 'DataBatcher' batch-processing .NET 2.0 | PowerShell | |||