Created
May 13, 2013 13:01
-
-
Save jtuttas/5568155 to your computer and use it in GitHub Desktop.
Wetter an der MMBBS mittels yahoo weather webservice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cls | |
| $webClient = new-object System.Net.WebClient | |
| $mmbbs = Read-Host ("Sind sie in der Schule hinter dem Proxy? j/n") | |
| if ($mmbbs -eq "j") { | |
| $proxy = new-object System.Net.WebProxy "10.20.30.55:3128" | |
| $login = Read-Host ("Benutzername") | |
| $pw = Read-Host ("Kennwort") | |
| $cred = New-Object System.Net.NetworkCredential $login, $pw | |
| $proxy.Credentials = $cred #(Get-Credential).GetNetworkCredential() | |
| #$proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials | |
| $webclient.proxy=$proxy | |
| } | |
| $webClient.Headers.Add("user-agent", "Windows Powershell WebClient Header") | |
| $webClient.UseDefaultCredentials = $true | |
| $url = 'http://weather.yahooapis.com/forecastrss?w=12833399&u=c' | |
| [XML]$alles = $webClient.DownloadString($url) | |
| $node= $alles.rss.channel.item.GetElementsByTagName("yweather:condition") | |
| Write-Host ("An der MMBBS sind es gerade "+$node[0].GetAttribute("temp")+" °C") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment