Send-RdsUserSessionMessage
Sends a system message to a user session.
Syntax
Send-RdsUserSessionMessage
[-TenantName] <String>
[-HostPoolName] <String>
[-SessionHostName] <String>
[-SessionId] <Int32>
[-MessageTitle] <String>
[-MessageBody] <String>
[-NoUserPrompt]
[<CommonParameters>]
Description
The Send-RdsUserSessionmessage cmdlet sends a system message to a specified user session. Because the user session ID is unique only within the context of a session host, a different session host server can share the same user session ID. The session host and session ID that you specify by using this cmdlet uniquely identify a session within a host pool. If the session ID is not present, then the message is broadcast to all user sessions on the session host.
Examples
Example 1: Send a message to a user session by providing all required information
PS C:\> Send-RdsUserSessionMessage -TenantName "contoso" -HostPoolName "contosoHostPool" -SessionHostName "sh1.contoso.com" -SessionId 1 -MessageTitle "Test announcement" -MessageBody "Test message."
This command sends a message to the specified user session. This command requires you to have looked up the user session previously to provide all of the required information. By running the Send-RdsUserSessionMessage cmdlet without the NoUserPrompt switch, you will be asked to confirm to send the message.
Example 2: Send a message to a user by searching for their user session
PS C:\> Get-RdsUserSession -TenantName "contoso" -HostPoolName "contosoHostPool" | where { $_.UserPrincipalName -eq "contoso\user1" } | Send-RdsUserSessionMessage -MessageTitle "Test announcement" -MessageBody "Test message." -NoUserPrompt
This command uses the Get-RdsUserSession cmdlet to search for the specific user's session, then pipes it into the Send-RdsUserSessionMessage cmdlet to send a message to the user session. By running the Send-RdsUserSessionMessage cmdlet with the NoUserPrompt switch, you will not receive any additional prompt to confirm to send the message.
Parameters
-HostPoolName
The name of the host pool.
Type: | String |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-MessageBody
The body of the message you want to send to the user session.
Type: | String |
Position: | 5 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-MessageTitle
The title of the message you want to send to the user session.
Type: | String |
Position: | 4 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-NoUserPrompt
The switch indicating that you would like to disconnect the user without any additional confirmation.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-SessionHostName
The name of the session host.
Type: | String |
Position: | 2 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-SessionId
The session ID correlating to the user session that will receive the message.
Type: | Int32 |
Position: | 3 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TenantName
The name of the tenant.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Inputs
System.String
System.Int32
Outputs
System.Object