Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Multi-Line Push Bullet Notification from PowerShell. Associated blogpost
# My Push Bullet Access Token
# Created via Profile Page
$pbAccessToken = 'yourPushBulletAccessToken'
# Push Bullet API URI
$pbApiURI = ""
# Web Request Header
$pbHeader = @{"Access-Token" = $pbAccessToken
'Content-Type' = "application/json"
# Format for Push Notification
$pbBodyStatus = $null
foreach ($user in $uClientStatus) {
if ($user.homeSince) {
$pbBodyStatus += "$($user.hostname) $($user.status) \nLast Seen: $($user.lastHome) \nHome Since: $($user.homeSince) \n\n"
else {
$pbBodyStatus += "$($user.hostname) $($user.status) \nLast Seen: $($user.lastHome) \n\n"
$pbBody = @{"type" = "note"
"title" = "Who's Home and Away"
"body" = $pbBodyStatus
# Send Push Bullet Notification
try {
$pbNotification = Invoke-RestMethod -Method Post -Headers $pbHeader -Uri ($pbApiURI + "v2/pushes") -Body ($pbBody | convertto-json).Replace('\\n', '\n')
if ($ = $true) {
write-host -ForegroundColor Green "Push Bullet Notification successfully sent"
catch {
write-host -ForegroundColor Red "Push Bullet Notification Failed to Send"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.