# Overview

PowerShell is a multifunctional command shell and scripting language used for automating tasks in Windows. Its capabilities allow for system management, process automation, and the creation of interactive scripts.

{% embed url="<https://docs.microsoft.com/en-us/powershell/?view=powershell-7.2>" %}

## Ways to Display Data

* Output text to the console `[Console]::WriteLine("PowerShell")`
* Show a full message box (MessageBox) `[System.Windows.Forms.MessageBox]::Show()`
* Input user data (InputBox)

  `[Microsoft.VisualBasic.Interaction]::InputBox()`

## Helper Commands

* Call help `Get-Help ForEach-Object -Parameter InputObject`
* Pause script execution (delay for 15 seconds) `Start-Sleep -s 15`

## Cmdlets

Cmdlets are small, purpose-built PowerShell commands that perform a specific function. They have a universal format: verb-noun (for example, `Get-Help`, `Get-Process`, `Start-Service`). Additionally, many cmdlets have short aliases for quick invocation:

* `Get-Process` → `gps`
* `Out-GridView` → `ogv`

This helps speed up work and write compact code.

* View properties and methods of a process object: `Get-Process | Get-Member`
* Visual interactive data view: `Get-Process | Out-GridView`
  * Data is displayed in a convenient table format, allowing the user to manually sort and filter items by various parameters.
  * Just type in the Sherpa console: `$Object | Out-GridView`, and a window with data will open, allowing you to view the contents of variables during debugging.
  * Easily integrate into Robot code in Sherpa Designer to display data during script execution. Each such window will remain open while the code is running (i.e., the window will close when the script execution ends or the stop execution button is pressed).

[More details](https://winitpro.ru/index.php/2021/04/21/out-gridview-gui-tablica-v-skripte-powershell/) or [here](https://forsenergy.com/en-us/windowspowershellhelp/html/8f657905-0eaf-4d10-ae93-3217eb97e0e3.htm) or in the [documentation](https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.gridview?view=netframework-4.8).

## Lexical Structure

{% embed url="<https://learn.microsoft.com/en-us/powershell/scripting/lang-spec/chapter-02?view=powershell-7.5&viewFallbackFrom=powershell-7>" %}

## Arithmetic Operations

{% embed url="<https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_arithmetic_operators?view=powershell-7.5&viewFallbackFrom=powershell-7.1>" %}

PowerShell supports standard arithmetic operations and can be used for complex calculations.

For example, measuring the execution speed of a block of commands: `1..10 | Measure-Command -Expression { <expression> }`, where `Measure-Command` allows you to determine the execution time of a specific expression.


---

# 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://docs.sherparpa.ru/en/sherpa-rpa/sherpa-designer/sherpa-designer-otvety-na-chasto-zadavaemye-voprosy/powershell/osnovnye-svedeniya.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.
