# RunScript

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

{% tabs %}
{% tab title="Parameter: RunScriptInput" %}

| Name                                 | Description                                                                                                                                                                                                                        |
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Parameters : `PowerShellParameter[]` | <p>Parameters for the script, provided switch parameters need to have a boolean value</p><p><br>Default: <code>-</code><br>Example: <code>foo, bar</code></p>                                                                      |
| ReadFromFile : `Boolean`             | <p>Should the script be read from a file or from the Script parameter</p><p><br>Default: <code>False</code><br>Example: <code>false</code></p>                                                                                     |
| ScriptFilePath : `String`            | <p>Location for the script file.</p><p><br>Default: <code>-</code><br>Example: <code>c:\temp\example.ps1</code></p>                                                                                                                |
| Script : `String`                    | <p>Location for the script file.</p><p><br>Default: <code>-</code><br>Example: <code>c:\temp\example.ps1</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>-</code><br>Example: <code>true</code></p> |
| {% endtab %}                         |                                                                                                                                                                                                                                    |

{% tab title="Parameter: RunOptions" %}

| Name                       | Description                                                                               |
| -------------------------- | ----------------------------------------------------------------------------------------- |
| Session : `SessionWrapper` | <p>Session parameter.</p><p><br>Default: <code>-</code><br>Example: <code>null</code></p> |
| {% endtab %}               |                                                                                           |

{% tab title="Result: PowerShellResult" %}

| Name                     | Description                                                                                                      |
| ------------------------ | ---------------------------------------------------------------------------------------------------------------- |
| Result : `IList<Object>` | <p>Result.<br>Example: <code>{Property1=Value1; Property2=Value2}</code></p>                                     |
| Errors : `IList<String>` | <p>Error(s).<br>Example: <code>"at , C:\temp\sample.ps1: line 1: The term 'foo' is not recognized..."</code></p> |
| Log : `String`           | <p>Log.<br>Example: <code>foo bar</code></p>                                                                     |
| {% endtab %}             |                                                                                                                  |

{% tab title="Changelog" %}

## Changelog

### \[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-21

#### Changed

* Memory leak fix.

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

#### Changed

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

### \[1.0.0] - 2022-02-25

#### Added

* Initial implementation
  {% endtab %}
  {% endtabs %}
