> For the complete documentation index, see [llms.txt](https://docs.frends.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.frends.com/tasks/tasks/powershell/runcommand.md).

# RunCommand

Task version: 1.2.0

Required Frends version: 5.5+

Required .NET version: 6.0

Compatible Agents: Crossplatform

Source code: <https://github.com/FrendsPlatform/Frends.PowerShell/tree/main/Frends.PowerShell.Runcommand>

## Task Parameters

{% tabs %}
{% tab title="RunCommandInput" %}

| Name                                 | Description                                                                                                                                                                                                                             |
| ------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Command : `String`                   | <p>The PowerShell command to execute</p><p><br>Default: <code>-</code><br>Example: <code>Example-Command</code></p>                                                                                                                     |
| Parameters : `PowerShellParameter[]` | <p>Parameters for the command, provided switch parameters need to have a boolean value</p><p><br>Default: <code>-</code><br>Example: <code>\[ foo, bar ]</code></p>                                                                     |
| LogInformationStream : `Boolean`     | <p>Should the information stream be logged. If false, log will be an empty string.</p><p>If set to true, a lot of string data may be logged. Use with caution.</p><p><br>Default: <code>False</code><br>Example: <code>false</code></p> |
| {% endtab %}                         |                                                                                                                                                                                                                                         |

{% tab title="RunOptions" %}

| Name                       | Description                                                                                                                                                                                        |
| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Session : `SessionWrapper` | <p>Session expression.</p><p><br>Default: <code>-</code><br>Example: <code>{System.Management.Automation.PowerShell} and {System.Management.Automation.Runspaces.LocalRunspace} values.</code></p> |
| {% endtab %}               |                                                                                                                                                                                                    |
| {% endtabs %}              |                                                                                                                                                                                                    |

## Task Result

| Name                     | Description                                                                                                                          |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
| Result : `IList<Object>` | <p>Result values.<br>Example: <code>{ foo, bar }</code></p>                                                                          |
| Errors : `IList<String>` | <p>Errors.<br>Example: <code>Encountered terminating error while executing powershell: Errors: "powershell.Streams.Error"</code></p> |
| Log : `String`           | <p>Log.<br>Example: <code>foobar.</code></p>                                                                                         |

## Task Changelog

Changelog for Task Frends.PowerShell.RunCommand.

### \[1.2.0] - 2024-10-09

#### Changed

* Added explicit reference to Microsoft.Management.Infrastructure
*

### \[1.1.0] - 2024-10-08

#### Changed

* Updated PowerShell version to 7.2.23

### \[1.0.2] - 2022-12-29

#### Fixed

* Memory leak fix by unloading assembly context after Task execution.

### \[1.0.1] - 2022-03-07

#### Changed

* Targeting changed to only include .NET 6.0 (removed .NET Standard 2.0)

### \[1.0.0] - 2022-03-04

#### Added

* Initial implementation


---

# 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 dynamically by asking a question.

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

```
GET https://docs.frends.com/tasks/tasks/powershell/runcommand.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.
