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
@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