Wednesday, March 27, 2013

Get notified when your computer reboots using Pushover


Pushover is a platform for sending and receiving push notifications to mobile devices (Android and iOS). Pushover is free, but requires the installation of a paid app on your Android or iOS device. After you set up your account on Pushover you get a user token that is used to identify you as the sender of a notification.
To send notifications, create a new application on the Pushover site. Give it a name, select type and upload an icon. After the application is registered you get an application token that identifies your application.

OK, so I wanted a notification sent to my phone whenever my computer restarted. Since it's a Windows 8 computer I decided to go for PowerShell 3.0 and created the following script:
$uri = "https://api.pushover.net/1/messages.json"
$parameters = @{
  token = "<app token>"
  user = "<user token>"
  title = "Reboot"
  message = "Your computer just rebooted"
}
$parameters | Invoke-RestMethod -Uri $uri -Method Post
Nothing special about the script, basically it's a slight modification of an example script found on the Pushover FAQ. Just replace <app token> and <user token> with your own tokens.

Next, I need to have the script run when the computer starts, and run before anyone logs on. That's the point, right, if I'm at the computer I don't need a notification telling me the computer restarted.
Run the Local Group Policy Editor (gpedit.msc) tool as administrator and drill down to Local Computer Policy -> Computer Configuration -> Windows Settings -> Scripts and open Startup.


Go to the PowerShell Scripts tab and click Add. Click Browse next to Script Name and locate your script. Click OK, OK and then close the policy editor.

All done!

5 comments:

  1. This is one of the most important blogs that I have seen, keep it up!
    webroot.com/safe

    ReplyDelete
  2. When you rent a computer you don't have to worry about the pesky finance charges that so often come attached to computer credit accounts. All the costs are in your monthly rental fee.
    navigate to this web-site

    ReplyDelete
  3. Its an incredible joy perusing your post.Its brimming with data I am searching for and I want to post a remark that "The substance of your post is magnificent" Great work.  Visit website

    ReplyDelete
  4. A very awesome blog post. We are really grateful for your blog post. You will find a lot of approaches after visiting your post. I was exactly searching for. Thanks for such post and please keep it up. Great work Ad spy

    ReplyDelete
  5. Particular interviews furnish firsthand message on mart size, industry trends, ontogeny trends, capitalist landscape and outlook, etc. visita il sito

    ReplyDelete