Invoke-RASRDSHostSessionCmd
Sends RDS session commands.
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>]
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.
-RDSServer <string> 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 <uint> Site ID.
If the parameter is omitted, the Licensing Server site ID will be used.
-RDSId <uint> The ID of a RD Session Host server.
To obtain the ID, use the Get-RDS cmdlet.
-Id <uint> Session ID.
To obtain the RDS Session ID, use the Get-RDSStatus command with StatusLevel as Level2.
-InputObject <RDPSession> The RDS Session Object.
To obtain a RDSSession object representing a RD Session, use the Get-RDSStatus command with StatusLevel as Level2."
-Command <RDSSessionCmd> Session command.
Accepted values: LogOff, SendMsg, Disconnect.
Possible values: LogOff, SendMsg, Disconnect
-MsgTitle <string> The message title for the session message.
-Message <string> The session message to be sent.
<CommonParameters>
-none-
---------- EXAMPLE 1 ----------
Invoke-RASRDSHostSessionCmd "server.company.dom" -Command LogOff -Id 6
Send the LogOff command to the server specified by name in the Licensing Server site (default).
To obtain the session ID, use the Get-RDSStatus cmdlet with StatusLevel as Level2. ---------- EXAMPLE 2 ----------
Invoke-RASRDSHostSessionCmd -RDSId 10 -Command SendMsg -Id 6 -Message "This is a message"
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 ----------
$RDPSession | Invoke-RASRDSHostSessionCmd -Command Disconnect
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.