When the iPhone 6 Plus came out availability was extremely limited, and you were meant to login to an Apple page around midnight every night to check for and reserve stock at your local store.

As time went on they started to release stock during the day as well, and at random times when shipments arrived and orders were cancelled, and these would all be reserved in literally 2 minutes.

I saw discussion on the internet about people scraping the page to notify them of when stock was available (and possibly reserving it, I don’t know), so I set up something similar just to shoot me an email and beep a lot to wake me up at midnight when a phone arrived.

It took a while but a shipment arrived and I made it! Anyway, here’s how it was done.

Set-StrictMode -Version Latest
$ErrorActionPreference = "Continue"

$emailAddress = "[email protected]"
$emailCredential = Get-Credential $emailAddress # Prompts for your password
$foundiPhone = $false

$myStores = @("R386") # Perth City, get yours from https://reserve.cdn-apple.com/AU/en_AU/reserve/iPhone/stores.json
$myiPhones = @("MGAC2X/A") # iPhone 6+ Space Grey 128GB

while ($true) {
    $availability = Invoke-WebRequest "https://reserve.cdn-apple.com/AU/en_AU/reserve/iPhone/availability.json" # Australia, there may be others for other countries

    # Ignore the ones with no content (e.g. the reservation page is down)
    if (-not ($availability.Content -eq "{ }")) {
        $availability = ConvertFrom-Json $availability.Content

        $myStores | %{
            $store = $_
            $myiPhones | Where { $availability.$store.$_ } | %{
                $foundiPhone = $true

                # Email settings for Hotmail
                Send-MailMessage -From $emailAddress -To $emailAddress -Subject "Your iPhone arrived!" -SmtpServer smtp.live.com -UseSsl $true -Credential $emailCredential 

    if ($foundiPhone) {
        # Wake up! Your computer is beeping!
        for ($i = 1; $i -lt 10; $i++) {
            [Console]::Beep(1000, 300)

        Write-Host "Sleeping"
        Start-Sleep -Seconds (60 * 5)

        $foundiPhone = $false