PowerShell Example for Checking PS3 Availability on Amazon

I used a PowerShell script to check price of Garmin i3 on Amazon. It’s very easy to modify it to check the availability of PS3. When the PS3 is not available, the price from the query is $0.00. So, if the price is greater than 0 that means it’s available. The script then prepares an email with a link to purchase it.

You need to change the SMTP server name ($smtpserver), your email address ($email) and AWSAccessKeyId ($awskey). If you don’t know how to get an AWSAccessKeyId, you can check out my original post for the Garmin i3. The default is to check the model with 60GB HD. Uncomment the second $asin to check the model with 20GB HD.

Once you test the script with your changes, use your favorite scheduler to check availability routinely.

# Script for checking PS3 on Amazon
$smtpserver = "smtp.nospam.com"

$email = "[email protected]"

$awskey = "YOUR-AWSAccessKeyId"

$asin = "B0009VXAM0" #60GB

#$asin = "B000IZWNLG" #20GB
$url =  "http://webservices.amazon.com/onca/xml?Service=AWSECommerceService"

$url += "&AWSAccessKeyId=" + $awskey

$url += "&Operation=ItemLookup"

$url += "&ItemId=" + $asin

$url += "&ResponseGroup=Offers"

$rxml = [xml](new-object Net.WebClient).DownloadString("$url")

$price =  $rxml.ItemLookupResponse.Items.Item.Offers.Offer.OfferListing.Price.Amount

$price = $price/100

if ($price -gt 0) {

    $textbody = "Playstation 3 is now $" + $price + " at Amazon "

    $textbody += "http://www.amazon.com/exec/obidos/ASIN/" + $asin + "/animereviews-20/ref=nosim"

    $smtp = new-object Net.Mail.SmtpClient($smtpserver)

    $smtp.send($email, $email , "PS3 Available at Amazon!", $textbody)