PoshCode Archive  Artifact Content

Artifact 425233102c36829b68d72f43dd1b074d42d86ed52e951b317502605f420651db:

  • File Send-Popup.ps1 — part of check-in [28663a7628] at 2018-06-10 14:14:31 on branch trunk — Send a popup message to a user on a remote computer. (user: Jack Neff size: 700)

# encoding: ascii
# api: powershell
# title: Send-Popup
# description: Send a popup message to a user on a remote computer.
# version: 0.1
# type: function
# author: Jack Neff
# license: CC0
# function: Send-Popup
# x-poshcode-id: 6379
# x-derived-from-id: 6390
# x-archived: 2016-08-17T23:48:43
# x-published: 2016-06-13T22:44:00
#
#
function Send-Popup {

    param ($Computername,$Message)

    if (Test-Connection -ComputerName $Computername -Count 1 -Quiet){
        Invoke-Command -ComputerName $Computername -ScriptBlock { param ($m) msg * $m } -ArgumentList $Message
        Write-Host "Message sent!"
    } else {
        Write-Host "Computer not online"
    }

}