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

Popular posts from this blog

Error: 0x80073701 when trying to add Print Services Role in Windows 2012 Standard

difference between wuauclt1.exe and wuauclt.exe

Windows 2016 RDS event 1306 Connection Broker Client failed to redirect the user... Error: NULL