Powershell script to read xml data from multiple remote computers
hello,
i'm trying put script read data simple xml file on multiple remote computers , output data csv file.
the remote computers listed in txt file (ex c:\scripts\computers.txt), path xml on remote computer same on computers (ex c$\drivers\scripts\version.xml) , layout of xml shown below. looking assistance in putting together.
<wsau>
<version>4.012</version>
</wsau>
thanks!
created below funciton pull servername , version.
function vert { $hostnamenodes = get-content c:\scripts\computers.txt
foreach ($hostname in $hostnamenodes) { [xml]$ver = get-content \\$hostname\c$\drivers\scripts\version.xml #add hostrecord array $masterarray = new-object psobject -property @{ "servername" = $hostname "version" = $ver.wsau.version } write-output $masterarray } } vert | select servername,version | export-csv ver.csv -notypeinformation
Comments
Post a Comment