# Invoke-RASVDISessionCmd

## NAME

Invoke-RASVDISessionCmd

## SYNOPSIS

Sends VDI session commands.

## SYNTAX

**Invoke-RASVDISessionCmd** \[-[InputObject](#InputObject)] _<_[_VDIRDPSession_](../classes-and-enumerations/vdirdpsession)_>_ -[Command](#Command) {LogOff | SendMsg | Disconnect} \[-[Message](#Message) _\<string>_] \[-[MsgTitle](#MsgTitle) _\<string>_] \[_<_[_CommonParameters_](#CommonParameters)_>_]

**Invoke-RASVDISessionCmd** \[-[ProviderId](#ProviderId)] _\<uint>_ -[Command](#Command) {LogOff | SendMsg | Disconnect} -[VDIHostId](#VDIHostId) _\<string>_ \[-[Message](#Message) _\<string>_] \[-[MsgTitle](#MsgTitle) _\<string>_] \[_<_[_CommonParameters_](#CommonParameters)_>_]

**Invoke-RASVDISessionCmd** \[-[VDIServer](#VDIServer)] _\<string>_ \[\[-[SiteId](#SiteId)] _\<uint>_] -[Command](#Command) {LogOff | SendMsg | Disconnect} -[VDIHostId](#VDIHostId) _\<string>_ \[-[Message](#Message) _\<string>_] \[-[MsgTitle](#MsgTitle) _\<string>_] \[_<_[_CommonParameters_](#CommonParameters)_>_]

## DESCRIPTION

Sends a session commands such as Logoff, Disconnect or send message.

It will not fail unless VDI (server or Provider ID) is invalid or command does not reach the destination.

If VDI Desktop ID is invalid, the command will not fail.

## PARAMETERS

-**VDIServer \<string>**\
The name of a Provider.

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 from which to retrieve the server.

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

-**ProviderId \<uint>**\
The ID of the provider.

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

```
        Required?                    true

        Position?                    0

        Default value                0

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

-**VDIHostId \<string>**\
Host ID.

To obtain the HostId, use the Get-RASVDIHost command.

```
        Required?                    true

        Position?                    named

        Default value                

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

-**InputObject <**[**VDIRDPSession**](../classes-and-enumerations/vdirdpsession)**>**\
The VDIRDPSession Object.

To obtain a VDIRDPSession object representing an VDI Session, use the Get-RASProviderStatus command with StatusLevel as Level3."

```
        Required?                    true

        Position?                    0

        Default value                

        Accept pipeline input?       true (ByValue)

        Accept wildcard characters?  false
```

-**Command <**[**VDISessionCmd**](../classes-and-enumerations/vdisessioncmd)**>**\
Session Command.

Accepted values: LogOff, SendMsg, Disconnect.

Possible values: LogOff, SendMsg, Disconnect

```
        Required?                    true

        Position?                    named

        Default value                0

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

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

```
        Required?                    false

        Position?                    named

        Default value                

        Accept pipeline input?       false

        Accept wildcard characters?  false
```

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

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

## INPUTS

[VDIRDPSession](../classes-and-enumerations/vdirdpsession)

## OUTPUTS

-none-

## EXAMPLES

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

Invoke-RASVDISessionCmd "server.company.dom" -Command LogOff -VDIDesktopId 42311235-09c5-ca15-337d-b9723015edf0

Invoke the VDI session to send the LogOff command from the Licensing Server site (default).\
&#xNAN;**---------- EXAMPLE 2 ----------**

Invoke-RASVDISessionCmd -ProviderId 10 -Command SendMsg -VDIDesktopId 42311235-09c5-ca15-337d-b9723015edf0 -Message "This is a message"

Invoke the VDI session to send the SendMsg command specified by ID.

To obtain the ProviderId, use the Get-RASProvider cmdlet.

To obtain the Desktop ID, use the Get-RASVDIDesktop cmdlet.\
&#xNAN;**---------- EXAMPLE 3 ----------**

$VDISession | Invoke-RASVDISessionCmd -Command Disconnect

Invoke the VDI session to send the Disconnect command, which is identified by an object obtained from the pipeline output.

To obtain the VDI Session, use the Get-RASProviderStatus cmdlet with StatusLevel as Level3.

## RELATED LINKS

* [Get-RASProvider](get-rasprovider)
* [Get-RASVDIHost](get-rasvdihost)
* [Get-RASProviderStatus](get-rasproviderstatus)
