# PowershellRM

Execute a script file or just couple lines of Powershell right in Rainmeter, natively. Results of invocation will be measure value and be updated along with skin update.

## Install

[Download](https://github.com/khanhas/PowershellRM/releases)

Download rmskin package, with example skins and plugin bundled.

or Download dll zip package and extract the dll corresponding to your Windows platform to `%appdata%\Rainmeter\Plugins`.

### Requirements

* .NET Framework 4.5 or later.
* PowerShell 3.0 or later.

{% hint style="info" %}
&#x20;Windows 10 already shipped with PowerShell 5.1 so everything works out of the box.&#x20;
{% endhint %}

#### Windows 7

Default PowerShell shipped in Windows 7 is 2.0. If you're not sure which version you have or upgraded, open PowerShell CLI and run

```
$PSVersionTable.PSVersion.Major
```

If value returned is `2`, download and upgrade newest PowerShell here: <https://www.microsoft.com/en-us/download/details.aspx?id=54616>

## Documentation

<https://khanhas.gitbook.io/powershellrm/>

## Basic usage

There are 2 ways to input your script:

#### 1. Uses script set in `Line` options:

```
[PSRM]
Measure = Plugin
Plugin = PowershellRM
Line  = Get-Process |
Line2 = Where-Object {$_.ProcessName -eq "explorer"} |
Line3 = Select -ExpandProperty "Path"
```

Last output object will be this measure value.

#### 2. Uses a PowerShell script file

```
[PSRM]
Measure = Plugin
Plugin = PowershellRM
ScriptFile = myScript.ps1
```

In this script file, you need to define function `Update` with no parameter.\
`Update` function is called every time skin updating and whatever it returning will be this measure value.

For more example usage, check out [example skins](https://github.com/khanhas/PowershellRM/tree/master/example-skins)


---

# Agent Instructions: 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://khanhas.gitbook.io/powershellrm/master.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.
