Edit

Share via


Send-RdsUserSessionMessage

Sends a system message to a user session.

Syntax

Default (Default)

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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-MessageBody

The body of the message you want to send to the user session.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:5
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-MessageTitle

The title of the message you want to send to the user session.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:4
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-NoUserPrompt

The switch indicating that you would like to disconnect the user without any additional confirmation.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SessionHostName

The name of the session host.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:2
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-SessionId

The session ID correlating to the user session that will receive the message.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:3
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-TenantName

The name of the tenant.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

System.String

System.Int32

Outputs

System.Object