Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Extracting a URL from an XML file

$
0
0
I'm trying to enumerate the SharePoint sites on a server. I've gotten so far as to run "stsadm -o enumsites", capturing the result, and storing it in an XML file that looks like this:

<?xml version="1.0"?>
<Sites Count="5">
<Site Url="https://bptc-server3" Owner="BPTC\sharepoint" SecondaryOwner="BPTC\bioadmin" ContentDatabase="WSS_Content" StorageUsedMB="0.2" StorageWarningMB="0" StorageMaxMB="0" />
<Site Url="https://bptc-server3/sites/Biocrescentia" Owner="BPTC\jfleming" SecondaryOwner="BPTC\hlevine" ContentDatabase="WSS_Content" StorageUsedMB="2178.2" StorageWarningMB="0" StorageMaxMB="0" />
<Site Url="https://bptc-server3/sites/DynPort" Owner="BPTC\jfleming" SecondaryOwner="BPTC\bioadmin" ContentDatabase="WSS_Content" StorageUsedMB="3544.9" StorageWarningMB="0" StorageMaxMB="0" />
<Site Url="https://bptc-server3/sites/Thermalin-QS" Owner="BPTC\bioadmin" SecondaryOwner="BPTC\jfleming" ContentDatabase="WSS_Content" StorageUsedMB="24.9" StorageWarningMB="0" StorageMaxMB="0" />
<Site Url="https://bptc-server3/sites/Typhoid" Owner="BPTC\jfleming" SecondaryOwner="aspnetmembershipprovider:bioadmin" ContentDatabase="WSS_Content" StorageUsedMB="101.7" StorageWarningMB="0" StorageMaxMB="0" />
</Sites>

but nothing I try from the _XMLDomWrapper.au3 library returns any of the URL strings, or anything containing them. How can I extract those URLs? The closest I've come is this:

#include <_XMLDomWrapper.au3>
#include <Array.au3>
#include <Constants.au3>

dim $cmdOUT
dim $AttVal[1]

; Get an XML file with all the sites listed
$PID = Run("C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm.exe -o enumsites -url https://bptc-server3","C:\",@SW_HIDE,$STDOUT_CHILD)
ProcessWait($PID)
While 1
	$line = StdoutRead($PID)
	If @error <> 0 Then ExitLoop
	$cmdOUT &= $line
Wend
$Handle = FileOpen("C:\Sites.xml",2)
FileWrite($Handle,'<?xml version="1.0"?>')
FileWrite($Handle,$cmdOUT)
FileClose($Handle)

; Get an array of the site URLs
$oOXml = _XMLFileOpen("C:\Sites.xml")
$AttVal = _XMLGetChildNodes("/Sites")
MsgBox(0,"Info",$AttVal)
_ArrayDisplay($AttVal,"Result")


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>