PoshCode Archive  Artifact [92da473866]

Artifact 92da473866a3891d017da4649189e679a09b82eff101b35110fca16ea38cd79a:

  • File Send-Popup.ps1 — part of check-in [41b7637de8] at 2018-06-10 13:49:57 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: 5086
# x-derived-from-id: 6379
# x-archived: 2017-03-19T19:32:26
# x-published: 2017-04-18T00:36: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"
    }

}