# Invoke-RASRDSHostSessionCmd

### NAME

Invoke-RASRDSHostSessionCmd\ <br>

### SYNOPSIS

Sends RDS session commands.\ <br>

### SYNTAX

Invoke-RASRDSHostSessionCmd \[-[InputObject](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostSessionCmd.html#InputObject)] *<*[*RDPSession*](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/types/RDPSession.html)*>* -[Command](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostSessionCmd.html#Command) {LogOff | SendMsg | Disconnect} \[-[Message](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostSessionCmd.html#Message) *\<string>*] \[-[MsgTitle](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostSessionCmd.html#MsgTitle) *\<string>*] \[*<*[*CommonParameters*](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostSessionCmd.html#CommonParameters)*>*]\
\
Invoke-RASRDSHostSessionCmd \[-[RDSId](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostSessionCmd.html#RDSId)] *\<uint>* -[Command](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostSessionCmd.html#Command) {LogOff | SendMsg | Disconnect} -[Id](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostSessionCmd.html#Id) *\<uint>* \[-[Message](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostSessionCmd.html#Message) *\<string>*] \[-[MsgTitle](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostSessionCmd.html#MsgTitle) *\<string>*] \[*<*[*CommonParameters*](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostSessionCmd.html#CommonParameters)*>*]\
\
Invoke-RASRDSHostSessionCmd \[-[RDSServer](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostSessionCmd.html#RDSServer)] *\<string>* \[\[-[SiteId](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostSessionCmd.html#SiteId)] *\<uint>*] -[Command](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostSessionCmd.html#Command) {LogOff | SendMsg | Disconnect} -[Id](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostSessionCmd.html#Id) *\<uint>* \[-[Message](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostSessionCmd.html#Message) *\<string>*] \[-[MsgTitle](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostSessionCmd.html#MsgTitle) *\<string>*] \[*<*[*CommonParameters*](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostSessionCmd.html#CommonParameters)*>*]\ <br>

### 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.\ <br>

### PARAMETERS

\
-**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.\ <br>

```
        Required?                    true
```

```
        Position?                    0
```

```
        Default value                
```

```
        Accept pipeline input?       false
```

```
        Accept wildcard characters?  false
```

\
-**SiteId \<uint>**\
Site ID.\
\
If the parameter is omitted, the Licensing Server site ID will be used.\ <br>

```
        Required?                    false
```

```
        Position?                    1
```

```
        Default value                0
```

```
        Accept pipeline input?       false
```

```
        Accept wildcard characters?  false
```

\
-**RDSId \<uint>**\
The ID of a RD Session Host server.\
\
To obtain the ID, use the Get-RDS cmdlet.\ <br>

```
        Required?                    true
```

```
        Position?                    0
```

```
        Default value                0
```

```
        Accept pipeline input?       false
```

```
        Accept wildcard characters?  false
```

\
-**Id \<uint>**\
Session ID.\
\
To obtain the RDS Session ID, use the Get-RDSStatus command with StatusLevel as Level2.\ <br>

```
        Required?                    true
```

```
        Position?                    named
```

```
        Default value                0
```

```
        Accept pipeline input?       false
```

```
        Accept wildcard characters?  false
```

\
-**InputObject <**[**RDPSession**](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/types/RDPSession.html)**>**\
The RDS Session Object.\
\
To obtain a RDSSession object representing a RD Session, use the Get-RDSStatus command with StatusLevel as Level2."\ <br>

```
        Required?                    true
```

```
        Position?                    0
```

```
        Default value                
```

```
        Accept pipeline input?       true (ByValue)
```

```
        Accept wildcard characters?  false
```

\
-**Command <**[**RDSSessionCmd**](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/types/RDSSessionCmd.html)**>**\
Session command.\
\
Accepted values: LogOff, SendMsg, Disconnect.\
\
Possible values: LogOff, SendMsg, Disconnect\ <br>

```
        Required?                    true
```

```
        Position?                    named
```

```
        Default value                0
```

```
        Accept pipeline input?       false
```

```
        Accept wildcard characters?  false
```

\
-**MsgTitle \<string>**\
The message title for the session message.\ <br>

```
        Required?                    false
```

```
        Position?                    named
```

```
        Default value                
```

```
        Accept pipeline input?       false
```

```
        Accept wildcard characters?  false
```

\
-**Message \<string>**\
The session message to be sent.\ <br>

```
        Required?                    false
```

```
        Position?                    named
```

```
        Default value                
```

```
        Accept pipeline input?       false
```

```
        Accept wildcard characters?  false
```

\
\<CommonParameters>

```
        This cmdlet supports the common parameters: Verbose, Debug,
```

```
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
```

```
        OutBuffer, PipelineVariable, and OutVariable. For more information, see 
```

```
        about_CommonParameters . 
```

<br>

### INPUTS

[RDPSession](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/types/RDPSession.html)

### OUTPUTS

-none-

### EXAMPLES

\
\&#xNAN;**---------- 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.\
\&#xNAN;**---------- 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.\
\&#xNAN;**---------- 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.\ <br>

###


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.parallels.com/landing/ras-powershell-api-guide/v19/parallels-ras-powershell-admin-module/commands/invoke-rasrdshostsessioncmd.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
