PowerShell your world cup

June 17, 2013

Table of Contents

PowerShell This is something that is very exciting and if you are interested you should try it. I found the post and tried it. Here is a function and how you use them.

  • Go to the kimono website and sign up for an account(http: //www.kimonolabs.com/signup)

This will get you an APIKey. Click your name once after you have logged in and then select your account.

  • Copy the API key and paste it below in the script and enjoy!

The Functions

$global:APIkey = “YOUR-KEY-GOES-HERE-FROM-STEP-2”

 

Function Get-WorldCupPlayer ($Country) {

    If ($Country) {

        $TeamID = (Get-WorldCupTeam -Country $Country).id

        Invoke-WebRequest -Uri (“http://worldcup.kimonolabs.com/api/players?teamId=$($TeamID)&apikey=$($ApiKey)”) | ConvertFrom-Json

    } Else {

        Invoke-WebRequest -Uri “http://worldcup.kimonolabs.com/api/players?apikey=$($ApiKey)” | ConvertFrom-Json

    }

}

Function Get-WorldCupTeam ($Country, $TeamID) {

    If ($Country) {

        Invoke-WebRequest -Uri (“http://worldcup.kimonolabs.com/api/teams?name=$($Country)&apikey=$($ApiKey)”) | ConvertFrom-Json

    }

    If ($TeamID) {

        Invoke-WebRequest -Uri (“http://worldcup.kimonolabs.com/api/teams?id=$($TeamID)&apikey=$($ApiKey)”) | ConvertFrom-Json

    }

 

    If (!$country -and !$TeamID) {

        Invoke-WebRequest -Uri “http://worldcup.kimonolabs.com/api/teams?apikey=$($ApiKey)” | ConvertFrom-Json

    }

}

Function Get-WorldCupStat {

    Invoke-WebRequest -Uri (“http://worldcup.kimonolabs.com/api/teams?sort=goalsFor,-1&apikey=$($ApiKey)”) | ConvertFrom-Json

}

Bring on the World Cup Fun

#Display the best team in the World Cup

Get-WorldCupTeam -Country “England”

Get-WorldCupStat | Format-Table

Get-WorldCupPlayer | Format-Table

Get-WorldCupPlayer -Country “England” | Format-Table

#Who has scored the most goals in the Netherland team so far?

Get-WorldCupPlayer -Country “Netherlands” | Foreach { $_ | Where

{ $_.goals -gt 0 } | Select firstName, lastName, goals } | sort goals –

Descending

#View the Logo of the team who is going to win

$logo = (New-Object System.Net.WebClient).DownloadFile(((Get-WorldCupTeam -Country “England”).logo), ($env:TEMP + “Logo.png”))

Invoke-Item $env:TEMPLogo.png

Home

Share on
Facebook
Twitter
LinkedIn
Pinterest
More posts

Dedicated Servers Quick Guide

What is a Dedicated Servers? Why bother using a dedicated server over a VPS or Shared Hosting?A dedicated server is a server 100% dedicated to your website/project or business needs.

Software Defined Single Sign On Database

Software Defined Single Sign On Database. One difficult task since the release of vSphere 5.1 has been the creation of SSO (Single Sign On) databases.  Creating an SSO database is

Five Considerations For Migrating Cloud Workloads

The benefits of migrating workloads between different cloud providers or between private and public clouds can only actually be achieved with an understanding of the cloud business model and cloud workload management.

vCloud API 5.1 Metadata

Over the years there has been a lot of changes in metadata in vCloud director,so am going to give te difference between the metadata in vCloud director 5.1 and the

VMware vCenter Server 5.1 Update 2

There are some new features in the new VMware released some days back a vCenter Server 5.1 update 2 build 1473063. This update enables the customization for windows 8.1, windows

Get 90% Discount

First 3 People gets the Bonus!
Don't Miss Out Our Big Sale

Get 0-90% On All
247Rack Services

247Rack

The Sale Is Until The End Of March