# Invoke-RASRDSHostCmd.md

## NAME

Invoke-RASRDSHostCmd

## SYNOPSIS

Sends a command to the RDS.

## SYNTAX

**Invoke-RASRDSHostCmd** \[[Id](#id-string)] *(uint)* -[Command](#Command) {EnableLogons | DrainUntilReboot | DrainUntilRestart | Drain | DisableLogonsAndReconnections | InstallTSRole | Reboot | CancelSchedule | CancelPendingReboot | CancelDisabledState | Shutdown} \[*(*[*CommonParameters*](#CommonParameters)*)*]

\*\*Invoke-RASRDSHostCmd \[-[InputObject](#inputobject)] *(*[*RDPSession*](https://docs.parallels.com/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/types/rdpsession)*)* -[Command](#Command) {EnableLogons | DrainUntilReboot | DrainUntilRestart | Drain | DisableLogonsAndReconnections | InstallTSRole | Reboot | CancelSchedule | CancelPendingReboot | CancelDisabledState | Shutdown} \[*(*[*CommonParameters*](#CommonParameters)*)*]

\*\*Invoke-RASRDSHostCmd \[[RDSServer](#rdsserver-string)] *(string)* \[\[-[SiteId](#siteid-string)] *(uint)*] -[Command](#Command) {EnableLogons | DrainUntilReboot | DrainUntilRestart | Drain | DisableLogonsAndReconnections | InstallTSRole | Reboot | CancelSchedule | CancelPendingReboot | CancelDisabledState | Shutdown} \[*(*[*CommonParameters*](#CommonParameters)*)*]

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

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

```
        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.

```
        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.

```
        Required?                    true

        Position?                    0

        Default value                0

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

## InputObject ([RDPSession](https://docs.parallels.com/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/types/rdpsession))

The RDS Object.

To obtain a RDS object use the Get-RASRDS command."

```
        Required?                    true

        Position?                    0

        Default value                

        Accept pipeline input?       true (ByValue)

        Accept wildcard characters?  false
```

## Command ([RDSCmd](https://docs.parallels.com/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/types/rdscmd))

Session command.

Accepted values: LogOff, SendMsg, Disconnect.

Possible values: EnableLogons, DrainUntilReboot, DrainUntilRestart, Drain, DisableLogonsAndReconnections, InstallTSRole, Reboot, CancelSchedule, CancelPendingReboot, CancelDisabledState, Shutdown

```
        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 documentation. 
```

## INPUTS

[RDPSession](https://docs.parallels.com/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/types/rdpsession)

## OUTPUTS

-none-

## EXAMPLES

\*\*---------- EXAMPLE 1 ----------

Invoke-RASRDSHostCmd "server.company.dom" -Id 2536 -Command Reboot

Invokes a restart on the RDS Server.\
\*\*---------- EXAMPLE 2 ----------

Invoke-RASRDSHostCmd -RDSId 10 -Id 2536 -Command DrainUntilReboot

The RDS Server will not allow new sessions until server is rebooted.\
\*\*---------- EXAMPLE 3 ----------

$RDPSessionApp | Invoke-RASRDSHostCmd -Command CancelDisabledState

The disabled state set by the RAS Scheduler is cancelled.

## RELATED LINKS

* [Get-RASRDSHost](https://docs.parallels.com/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/commands/get-rasrdshost)
* [Get-RASRDSHostStatus](https://docs.parallels.com/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/commands/get-rasrdshoststatus)
* [Invoke-RASRDSHostSessionCmd](https://docs.parallels.com/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/commands/invoke-rasrdshostsessioncmd)
* [Invoke-RASRDSHostProcessCmd](https://docs.parallels.com/landing/ras-powershell-api-guide/v20/parallels-ras-powershell-admin-module/commands/invoke-rasrdshostprocesscmd)
