[xml]$Weather = Get-Content "C:\Users\Morten\Downloads\GetMeasuredWeatherData.xml" $IDLygna = "206" $IDBekkehallum = "207" $EndResult = @() $IDs = "206","207" Foreach ($place in $IDs) { $Location = $Weather.d2LogicalModel.payloadPublication.siteMeasurements | Where-Object { $_.measurementsitereference.id -eq $place } $LocationAirTemp = ($Location.measuredValue | Where-Object {$_.index -eq "101"}).innertext + " °C" $LocationRoadTemp = ($Location.measuredValue | Where-Object {$_.index -eq "801"}).innertext + " °C" $LocationPrecipitation = ($Location.measuredValue | Where-Object {$_.index -eq "2501"}).innertext + " mm/h" $Place = $place -replace "206","Lygna" -replace "207","Bekkehallum" $Resultname = new-object psobject -Property @{ Lokasjon = $place Lufttemperatur = $LocationAirTemp Veibanetemperatur = $LocationRoadTemp Nedbørintensitet = $LocationPrecipitation } $EndResult += $ResultName } $EndResult $a = "" $a = $a + '' $b = "
" $b = $b + "

Værstatistikk

" $code = $EndResult|ConvertTo-Html -Head $a -Body $b $code | Out-File C:\temp\mesta.html Write-host -fore Yellow "## Starting FTP upload.." $File = "C:\temp\mesta.html"; $ftp = "ftp://morten:redacted@web.home.zyrex.org//home/httpd/sites/zyrex.org/temp/mesta.html"; $webclient = New-Object -TypeName System.Net.WebClient; $uri = New-Object -TypeName System.Uri -ArgumentList $ftp; Write-Host -fore Yellow "## Uploading $File..."; $webclient.UploadFile($uri, $File);