PowerShell: Send Private Message to Another Computer

$name = read-host "Enter remote computer name "
$messageInput = read-host "Enter your message to send to remote computer "
$prefix = "Message from $($env:computername) $($env:username)`: "
$msg = $prefix + $messageInput;
Invoke-WmiMethod -Path Win32_Process -Name Create -ArgumentList "msg * $msg" -ComputerName $name

Leave a Reply

Your email address will not be published. Required fields are marked *