Skip to content

Instantly share code, notes, and snippets.

@halr9000
Created August 8, 2012 19:45
Show Gist options
  • Save halr9000/3298002 to your computer and use it in GitHub Desktop.
Save halr9000/3298002 to your computer and use it in GitHub Desktop.
Sample to send message via Pushover from Windows PowerShell
# Using any version of PowerShell
$parameters = New-Object System.Collections.Specialized.NameValueCollection
$parameters.Add("token", "APP_TOKEN")
$parameters.Add("user", "USER_KEY")
$parameters.Add("message", "hello world")
$client = New-Object System.Net.WebClient
$client.UploadValues("https://api.pushover.net/1/messages.json", $parameters)
# Using PowerShell v3 only with new Invoke-RestMethod cmdlet
$uri = 'https://api.pushover.net/1/messages.json'
$parameters = @{
token = "APP_TOKEN"
user = "USER_KEY"
message = "hello world"
}
$parameters | Invoke-RestMethod -Uri $uri -Method Post
@halr9000
Copy link
Author

halr9000 commented Aug 8, 2012

This is intended to be a direct port of the other examples given on the FAQ page for Pushover, and as such doesn't have all the bells and whistles you'd expect in a proper function, such as parameters, help, and so on.

@Skippy28
Copy link

Can the current date, time and computer name be added to the body of the message using powershell?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment