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:
<?xml version="1.0" encoding="utf-8"?>
<appPool name="MyAppPool">
<enable32BitAppOnWin64>true</enable32BitAppOnWin64>
<managedPipelineMode>Integrated</managedPipelineMode>
<managedRuntimeVersion>v4.0</managedRuntimeVersion>
<autoStart>true</autoStart>
</appPool>
Here's what I'm trying to do with it:
#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
}
$_.Name returns the name of the node, (i.e. enable32BitAppOnWin64) which is correct, but the .Value property doesn't return anything. How do I extract the data I want?