Windows 7 / Getting Started

Sending Messages to Users

Shutting down an RD Session Host server or VM without telling users is apt to annoy them. Even if you plan to start maintenance after work hours, it's still a good idea to let users know that they should shut down their sessions completely, not just disconnect them. You can also send messages for less drastic reasons, such as telling a user to resend a print job or warning users to shut down an application.

One way to communicate with your user base is by sending messages from the Remote Desktop Services Manager or by using the msg command-line tool. Using these tools, you can communicate with individuals, selected groups, or everyone logged on to the server. You can even wait for acknowledgement of your message.

NOTE: Using the techniques described in the rest of this tutorial, you can send messages to users logged on to VMs as well as users logged on to sessions. Only one person will be logged on to each VM, however, so the broadcast functionality won't work on VMs as it does for sessions. That is, you can't use it to send a message to all VMs on an RD Virtualization Host.

From the Remote Desktop Services Manager, right-click a session on an RD Session Host or VM and select Send Message.

The message contains the sender's user name and the time that the message is sent. Type your message in the Send Message dialog box and click OK. The user will see a message box.

Unlike the shadowing feature, sending messages is supported for RemoteApp programs. Users running RemoteApp programs or full desktop sessions receive the same message box; the only difference is that RemoteApp programs users get a message box on their local desktop, whereas users running a full desktop session receive the message in that session window. You can also use the msg command-line utility to send a message to a session like this.

?
msg nancy.anderson /SERVER:FUJI Nancy, Tech Support has reviewed your case, and will be
with you in 5 minutes.

If you are not running the msg command from the same RD Session Host server as the one where the session is hosted, then you must specify the server (or VM) as shown in the example. You can specify sessions based on user name, session ID, or session name. Use the query command or the Remote Desktop Services Manager to get any of these data points.

If you have not limited users to one session per server, then you might need to send a message to every session that user has open. If you provide the user name as an argument, the message will appear in all sessions belonging to that user. To send a message to all sessions on a server, use the * argument. For example, to send a message to every session on server FUJI, run this command.

msg * /SERVER:FUJI This server will be rebooted at 3pm. Please close your RemoteApp
programs.

You can also send a message to all users on an RD Session Host server, session IDs, or session names contained in a file. Using a file to specify who should receive a message can be helpful if you need to communicate with a group of users, but not every single person using the server. For instance, maybe you need to tell all users from the accounting department on server FUJI to shut down the accounting application. To do this, first create a file containing the user names of the accounting department users. This is most easily done from Windows PowerShell with the following script, which gets the names of the users in the ASH_Accounting_Users OU and adds them to a file named c:\scripts\ash-acct-users.txt. Obviously, you'll need to modify the Lightweight Directory Access Protocol (LDAP) paths and file name for your purposes.

$OU = [ADSI] "LDAP://OU=ASH_Accounting_Users, DC=ASH, DC=local"
$UserList = "c:\scripts\ash-acct-users.txt"
foreach ($child in $ou.psbase.children)
{
out-file -filepath $UserList -append -inputobject $child.name
}

When you have the names in the file, then you can run the msg command as shown here.

msg @ c:\scripts\ash-acct-users.txt /SERVER:FUJI Please close the accounting
application.
[Previous] [Contents] [Next]