> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell-universal/powershell-commands/invoke-psucommand.md).

# Invoke-PSUCommand

Invoke-PSUCommand sends events to an event hub or a specific computer in PowerShell Universal, optionally running a remote command.

### Synopsis

Sends events to an event hub.

### Syntax

```powershell
Invoke-PSUCommand [-AppToken <String>] [-ComputerName <String>] [-Data <Object>] -Hub <String> [-Integrated] [-UseDefaultCredentials] [-ConnectionId <String>] [-Credential <PSCredential>] [-TrustCertificate] [-Timeout <Int32>] [<CommonParameters>]

Invoke-PSUCommand [-AppToken <String>] [-ComputerName <String>] [-Data <Object>] [-Integrated] [-UseDefaultCredentials] -Computer <String> [-Credential <PSCredential>] [-TrustCertificate] [-Timeout <Int32>] [<CommonParameters>]

Invoke-PSUCommand [-AppToken <String>] [-ComputerName <String>] -Hub <String> [-Integrated] [-UseDefaultCredentials] [-ConnectionId <String>] [-Command <String>] [-Credential <PSCredential>] [-Parameters <Hashtable>] [-TrustCertificate] [-Timeout <Int32>] [<CommonParameters>]

Invoke-PSUCommand [-AppToken <String>] [-ComputerName <String>] [-Integrated] [-UseDefaultCredentials] [-Command <String>] -Computer <String> [-Credential <PSCredential>] [-Parameters <Hashtable>] [-TrustCertificate] [-Timeout <Int32>] [<CommonParameters>]
```

### Description

Sends events to an event hub.

### Parameters

#### -AppToken

The app token used when accessing the PowerShell Universal Management API.

```
Required?                    false
Position?                    named
Default value                None
Accept pipeline input?       False
Aliases                      none
Accept wildcard characters?  false
```

#### -ComputerName

The URL or host name of the PowerShell Universal server.

```
Required?                    false
Position?                    named
Default value                None
Accept pipeline input?       False
Aliases                      Uri
Accept wildcard characters?  false
```

#### -Data

The data to send to the client. This data will be serialized to CliXml and deserialized on the client.

```
Required?                    false
Position?                    named
Default value                None
Accept pipeline input?       False
Aliases                      none
Accept wildcard characters?  false
```

#### -Hub

The name of the event hub to send the event to.

```
Required?                    true
Position?                    named
Default value                None
Accept pipeline input?       False
Aliases                      none
Accept wildcard characters?  false
```

#### -Integrated

Uses the in-process management client when running inside PowerShell Universal.

```
Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       False
Aliases                      none
Accept wildcard characters?  false
```

#### -UseDefaultCredentials

Uses the current Windows credentials to connect to PowerShell Universal.

```
Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       False
Aliases                      none
Accept wildcard characters?  false
```

#### -ConnectionId

The connection ID to send the event to. If not specified, the event will be sent to all connected clients.

```
Required?                    false
Position?                    named
Default value                None
Accept pipeline input?       False
Aliases                      none
Accept wildcard characters?  false
```

#### -Command

The command to run on the agent.

```
Required?                    false
Position?                    named
Default value                None
Accept pipeline input?       False
Aliases                      none
Accept wildcard characters?  false
```

#### -Computer

The computer to run this command on.

```
Required?                    true
Position?                    named
Default value                None
Accept pipeline input?       False
Aliases                      none
Accept wildcard characters?  false
```

#### -Credential

Credentials to login to the PowerShell Universal Management API.

```
Required?                    false
Position?                    named
Default value                None
Accept pipeline input?       False
Aliases                      none
Accept wildcard characters?  false
```

#### -Parameters

A hashtable of parameters to send to the command.

```
Required?                    false
Position?                    named
Default value                None
Accept pipeline input?       False
Aliases                      none
Accept wildcard characters?  false
```

#### -TrustCertificate

Whether the cmdlet should ignore certificate issues.

```
Required?                    false
Position?                    named
Default value                False
Accept pipeline input?       False
Aliases                      none
Accept wildcard characters?  false
```

#### -Timeout

The timeout in seconds for the command to run.

```
Required?                    false
Position?                    named
Default value                None
Accept pipeline input?       False
Aliases                      none
Accept wildcard characters?  false
```

#### Common parameters

This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see [about\_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).

### Inputs

None

### Outputs

System.Object

### Notes

### Examples

#### Example 1

```powershell
Invoke-PSUCommand -Hub 'MyHub' -Data @{ Name = 'Adam' }
```

Sends an event to the MyHub event hub. All connected clients will receive the event.

## PERMISSIONS

The access token requires `apis.eventhubs/execute` to run this cmdlet remotely. This also applies when the command targets a computer or computer group.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.devolutions.net/powershell-universal/powershell-commands/invoke-psucommand.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
