I am writing an automated site backup powershell script.
I have the following xml in an [xml] casted variable obtained from appcmd.exe:
<application path="/" applicationPool="komplus.ua-PROD">
<virtualDirectoryDefaults />
<virtualDirectory path="/" physicalPath="C:\WEB\PROD\komplus.ua" />
</application>
<application path="/kb" applicationPool="komplus.ua-PROD" enabledProtocols="http, https">
<virtualDirectoryDefaults />
<virtualDirectory path="/" physicalPath="C:\WEB\PROD\komplus.ua\kb" />
</application>
The xml is in the variable $xmlInput.
I need to get the value of the physicalPath attribute of VirtualDirectory element in first application element.
I've tried several options, including custom Get-XmlElement functions, but can't seem to get to the value.
Currently I have:
$selectResult = $xmlInput.application.virtualDirectory | Select physicalPath
But the $selectResult is null.
Please assist in which parsing is correct to get the value I need.
No comments:
Post a Comment