Can't extract value of XML nodes with powershell

kyismaster

New Member
I'm trying to extract some info from an xml file and update/create an app pool as needed. Here's the xml I'm reading in:\[code\]<?xml version="1.0" encoding="utf-8"?><appPool name="MyAppPool"> <enable32BitAppOnWin64>true</enable32BitAppOnWin64> <managedPipelineMode>Integrated</managedPipelineMode> <managedRuntimeVersion>v4.0</managedRuntimeVersion> <autoStart>true</autoStart></appPool>\[/code\]Here's what I'm trying to do with it:\[code\]#read in the xml$appPoolXml = [xml](Get-Content $file)#get the name of the app pool$name = $appPoolXml.appPool.name#iterate over the nodes and update the app pool$appPoolXml.appPool.ChildNodes | % { #this is where the problem exists set-itemproperty IIS:\AppPools\$name -name $_.Name -value $_.Value}\[/code\]\[code\]$_.Name\[/code\] returns the name of the node, (i.e. \[code\]enable32BitAppOnWin64\[/code\]) which is correct, but the \[code\].Value\[/code\] property doesn't return anything. How do I extract the data I want?
 
Back
Top