Created
August 8, 2012 19:45
-
-
Save halr9000/3298002 to your computer and use it in GitHub Desktop.
Sample to send message via Pushover from Windows PowerShell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
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
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.