Remote Desktop messaging

From DanIT
Jump to navigation Jump to search

When a user has messaging rights, they can send pop-up style texts to other user sessions.
In order to apply the messaging permission, please see the Remote Desktop permissions article.

There are multiple methodes to send a message, this article will show you multiple possibilities with examples.

Task Manager

Open the Task Manager (right-click the Taskbar > Task Manager), go to the Users-tab, right-click a user and select Send message.
Here you can send a custom text with custom title to one user at the time, this will only work with users that are logged onto the same server.
The pop-up box will stay on top of all applications and will not dissapear until the user has clicked OK.


RDPermissions-5.png


RDPermissions-6.png


RDPermissions-7.png

msg.exe

msg.exe is console application that is included by default in every recent Windows edition, it has other features than the Task Manager methode.
You can send messages to other machines as well, and you have the ability to send the message to every user session on that machine.
The downside of this methode is that the pop-up message will not display an information icon, and that the title of the pop-up is not customizable.

For example, to send a message to everyone on another server, you could enter the following in a command prompt:

msg.exe /server:HOSTNAME /time:0 * This is an example message.

The "/time:0" argument is used because by default while using msg.exe, the message would only display for 60 seconds, 0 would make it show indefinitely.
The "*" argument is to indicate that the message should be send to all sessions on that server, you could replace it with a username or session ID.

PowerShell

It is understandable that you would want this feature to be more user-friendly.
You could use this PowerShell script so that the end user would only have to open the script and enter a text to send a message to all sessions on all servers:

$servers = @(
"server1.domain.local"
"server2.domain.local"
"server3.domain.local"
)

Write-Host "Enter the message you want to send to everyone: " -ForegroundColor Yellow -NoNewline; $text = Read-Host

foreach($server in $servers)
{
    Start-Process -FilePath "msg.exe" -ArgumentList ("/server:"+$server+" /time:0 * "+$text) -WindowStyle Hidden
}

Custom application

RDPermissions-8.png

You could also for make a Visual Studio application written in C++, VB, or C#.
This example is made in C#, the form has a Rich Textbox and a Button, a list of servers called "servers.txt" is located besides the executable:

private void btnSend_Click(object sender, EventArgs e)
{
    foreach (string line in File.ReadLines("servers.txt"))
    {
        Process process = new Process();
        process.StartInfo.FileName = "msg.exe";
        process.StartInfo.Arguments = @"/server:" + line + " /time:0 * " + rtbText.Text;
        process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
        process.Start();
    }
}

You can download this Visual Studio project here: http://downloads.danit.nl/Remote-Desktop-Messenger.zip