PoshCode Archive  Artifact Content

Artifact 5eacec78cfda103bd3a7054dc0bb1f03965ac0db08906b2b52f89fed3c5a4d1b:

  • File Send-Popup.ps1 — part of check-in [01a8a24f9f] at 2018-06-10 14:15:49 on branch trunk — Send a popup message to a user on a remote computer. (user: sdfsdfsdfsdfsdf size: 706)

# 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: sdfsdfsdfsdfsdf
# license: CC0
# function: Send-Popup
# x-poshcode-id: 6440
# x-derived-from-id: 6448
# x-archived: 2016-08-14T13:41:00
# x-published: 2016-07-01T20:17: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"
    }

}