# Invoke-RASRDSHostCmd

### NAME

Invoke-RASRDSHostCmd\ <br>

### SYNOPSIS

Sends a command to the RDS.\ <br>

### SYNTAX

Invoke-RASRDSHostCmd \[-[Id](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostCmd.html#Id)] *\<uint>* -[Command](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostCmd.html#Command) {EnableLogons | DrainUntilReboot | DrainUntilRestart | Drain | DisableLogonsAndReconnections | InstallTSRole | Reboot | CancelSchedule | CancelPendingReboot | CancelDisabledState | Shutdown} \[*<*[*CommonParameters*](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostCmd.html#CommonParameters)*>*]\
\
Invoke-RASRDSHostCmd \[-[InputObject](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostCmd.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-RASRDSHostCmd.html#Command) {EnableLogons | DrainUntilReboot | DrainUntilRestart | Drain | DisableLogonsAndReconnections | InstallTSRole | Reboot | CancelSchedule | CancelPendingReboot | CancelDisabledState | Shutdown} \[*<*[*CommonParameters*](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostCmd.html#CommonParameters)*>*]\
\
Invoke-RASRDSHostCmd \[-[RDSServer](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostCmd.html#RDSServer)] *\<string>* \[\[-[SiteId](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostCmd.html#SiteId)] *\<uint>*] -[Command](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostCmd.html#Command) {EnableLogons | DrainUntilReboot | DrainUntilRestart | Drain | DisableLogonsAndReconnections | InstallTSRole | Reboot | CancelSchedule | CancelPendingReboot | CancelDisabledState | Shutdown} \[*<*[*CommonParameters*](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/cmdlets/Invoke-RASRDSHostCmd.html#CommonParameters)*>*]\ <br>

### DESCRIPTION

Sends a command to the RDS.\
\
It will only fail with an error if the name or ID of the target RD Session Host server is invalid.\ <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
```

\
-**Id \<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
```

\
-**InputObject <**[**RDPSession**](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/types/RDPSession.html)**>**\
The RDS Object.\
\
To obtain a RDS object use the Get-RASRDS command."\ <br>

```
        Required?                    true
```

```
        Position?                    0
```

```
        Default value                
```

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

```
        Accept wildcard characters?  false
```

\
-**Command <**[**RDSCmd**](https://download.parallels.com/ras/v19/docs/en_US/Parallels-RAS-v19-PowerShell-Guide/RASAdmin/types/RDSCmd.html)**>**\
Session command.\
\
Accepted values: LogOff, SendMsg, Disconnect.\
\
Possible values: EnableLogons, DrainUntilReboot, DrainUntilRestart, Drain, DisableLogonsAndReconnections, InstallTSRole, Reboot, CancelSchedule, CancelPendingReboot, CancelDisabledState, Shutdown\ <br>

```
        Required?                    true
```

```
        Position?                    named
```

```
        Default value                0
```

```
        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-RASRDSHostCmd "server.company.dom" -Id 2536 -Command Reboot\
\
Invokes a restart on the RDS Server.\
\&#xNAN;**---------- EXAMPLE 2 ----------**\
\
Invoke-RASRDSHostCmd -RDSId 10 -Id 2536 -Command DrainUntilReboot\
\
The RDS Server will not allow new sessions until server is rebooted.\
\&#xNAN;**---------- EXAMPLE 3 ----------**\
\
$RDPSessionApp | Invoke-RASRDSHostCmd -Command CancelDisabledState\
\
The disabled state set by the RAS Scheduler is cancelled.


---

# 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-rasrdshostcmd.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.
