For the complete documentation index, see llms.txt. This page is also available as Markdown.

Invoke-RASRDSHostSessionCmd

SYNOPSIS

Sends RDS session commands.

SYNTAX

Invoke-RASRDSHostSessionCmd [-InputObject] <RDPSession> -Command {LogOff | SendMsg | Disconnect}
 [-Message <string>] [-MsgTitle <string>] [<CommonParameters>]
Invoke-RASRDSHostSessionCmd [-RDSId] <uint> -Command {LogOff | SendMsg | Disconnect} -Id <uint>
 [-Message <string>] [-MsgTitle <string>] [<CommonParameters>]
Invoke-RASRDSHostSessionCmd [-RDSServer] <string> [[-SiteId] <uint>]
 -Command {LogOff | SendMsg | Disconnect} -Id <uint> [-Message <string>] [-MsgTitle <string>]
 [<CommonParameters>]

DESCRIPTION

Sends a session command such as LogOff, Disconnect, or Send Message.

It will only fail with an error if the name or ID of the RD Session Host server is invalid or command does not reach the destination.

If the session ID is invalid, the command will not fail.

EXAMPLES

Example 1

Send the LogOff command to the server specified by name in the Licensing Server site (default).

To obtain the session ID, use the Get-RASRDSHostStatus cmdlet with StatusLevel as Level2.

Example 2

Send the SendMsg command to the server specified by ID to send the specified message.

To obtain the ID, use the Get-RASRDSHost cmdlet.

To obtain the session ID, use the Get-RASRDSHostStatus cmdlet with StatusLevel as Level2.

Example 3

Send the Disconnect command for the session, which is identified by an object obtained from the pipeline output.

To obtain the $RDPSession object, use the Get-RASRDSHostStatus cmdlet with StatusLevel as Level2.

PARAMETERS

-RDSServer

The name of a RD Session Host server.

The name can be either FQDN or IP address, but you have to enter the actual name this server has in the RAS farm.

-SiteId

Site ID.

If the parameter is omitted, the Licensing Server site ID will be used.

-RDSId

The ID of a RD Session Host server.

To obtain the ID, use the Get-RASRDSHost cmdlet.

-Id

Session ID.

To obtain the RDS Session ID, use the Get-RASRDSHostStatus command with StatusLevel as Level2.

-InputObject

The RDS Session Object.

To obtain a RDSSession object representing a RD Session, use the Get-RASRDSHostStatus command with StatusLevel as Level2."

Type reference: RDPSession

-Command

Session command.

Accepted values: LogOff, SendMsg, Disconnect.

Possible values: LogOff, SendMsg, Disconnect

Type reference: RDSSessionCmd

-MsgTitle

The message title for the session message.

-Message

The session message to be sent.

CommonParameters

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

INPUTS

RDPSession

OUTPUTS

None

Last updated