How do I find a word in an XML file
and if not there , if is, else.
specificaly looking node in web.config file. if there, check value of attribute.
if not there want add node, know how do. (thank all!)
i thoght had working last week, says can't run process on null value when node not found.
here string causes error:
$wctochange = $xml.configuration."system.webserver".security.requestfiltering.requestlimits.getattribute("maxallowedcontentlength")
hi olddog1,
if want node xml-file, better use xml "system.xml.xmldocument object" in powershell have access xml specific methods , properties. "select-string" handle xml normal txt document , string objects, isn´t wrong @ want show solution:
$path = "c:\test.xml" $xmldata = [xml](get-content $path) $xmldata.selectnodes("/rootnode/node2/requestlimits")shows values of requestlimits nodes. more xml properties , methods go here http://msdn.microsoft.com/en-us/library/y3y47afh.aspx or call get-member after curtain object. example: $xmldata | get-member
Windows Server > Windows PowerShell
Comments
Post a Comment