---
title: "PowerShellProv"
description: "Configure the Identity Manager connector that writes to an external system via a PowerShell script, with Edition and Options settings."
sidebar_position: 200
---

# PowerShellProv

This connector writes to an external system via a [PowerShell](https://learn.microsoft.com/en-us/powershell/scripting/overview) script.

This page is about [PowerShellProv](../references-packages/powershellprov.md).

![Package: Custom/PowerShellProv](/images/identitymanager/packages_powershellprov_v603.webp)

## Overview

PowerShell is a cross-platform task automation and configuration management framework, consisting of a command-line shell and scripting language. Unlike most shells which accept and return text, PowerShell is built on top of the .NET Common Language Runtime (CLR), and accepts and returns .NET objects. This fundamental change brings entirely new tools and methods for automation.

## Prerequisites

Implementing this connector requires:

- making sure that the appropriate PowerShell executable is installed on the device hosting the agent: by default (`Edition` set to `Desktop`), the connector runs `powershell.exe` (Windows Powershell 5.1); when `Edition` is set to `Core`, the connector runs `pwsh` (PowerShell 7);
- knowledge of scripting in PowerShell 5.1 (Windows PowerShell, [see here requirements](https://docs.microsoft.com/en-us/powershell/scripting/windows-powershell/install/windows-powershell-system-requirements)) or PowerShell 7 (PowerShell Core, [see support lifecycle here](https://learn.microsoft.com/en-us/powershell/scripting/install/powershell-support-lifecycle)) depending on the selected `Edition`;
- making sure that the device hosting the agent has its execution policy properly configured to
execute the given PowerShell script;
- checking the targeted system's requirements (environment, libraries, etc.), as this connector is
meant to connect Identity Manager to a PowerShell-compatible system;
- writing and testing a PowerShell script (`.ps1`) according to Netwrix Identity Manager (formerly
Usercube)' guidelines below.

Windows PowerShell 5.1 is in maintenance mode. Netwrix recommends using `Edition: "Core"` (`pwsh`) for new connections where possible.

## Export

There are no export capabilities for this connector.

## Fulfill

This connector executes a PowerShell script for the creation, deletion and update of any entity linked to the managed system.

> For example, it can fulfill the `mailboxes` entity from Microsoft Exchange.

### Configuration

This process is configured through a [Connection](../../../integrations/toolkit/xml-configuration/connectors/connection.md) in the UI and/or the XML configuration, and in the `*appsettings.agent.json* > Connections` section:

```json
*appsettings.agent.json*
{
  ...
  "Connections": {
    ...
    "<ConnectionIdentifier>": {
      ...
    }
  }
}
```

The identifier of the connection and thus the name of the subsection must:

- be unique.
- not begin with a digit.
- not contain `<`, `>`, `:`, `"`, `/`, `\`, `|`, `?`, `*` and `_`.

> The following example fills a CSV file through the script `Fulfill-CSV.ps1`, for a single target
> managed system identified by the `PowerShellCsvFulfillment` subsection:
>
> ```
> *appsettings.agent.json*
> {
>   ...
>   "Connections": {
>     ...
>     "PowerShellCsvFulfillment": {
>       "PowerShellScriptPath": "C:/identitymanagerDemo/Scripts/Fulfill-CSV.ps1",
>       "Options": {
>         "Message": "Hello",
>         "Login": "admin",
>         "Password": "secret"
>       }
>     }
>   }
> }
> ```

#### Setting attributes

 | Name | Details |
 | --- | --- |
 | PowerShellScriptPath required | **Type** String **Description** Path of the executed PowerShell script (.ps1). |
 | Edition optional | **Type** String **Description** Selects which PowerShell executable runs the script: `Desktop` (default) uses `powershell.exe` (Windows Powershell 5.1), `Core` uses `pwsh` (PowerShell 7). **Example** `"Edition": "Core"` |
 | Options optional | **Type** String Pair List **Description** List of key-value pairs for all the variables required by the PowerShell script. **Example** `   "Options": {    "Login": "admin",    "Password": "secret"   }` In order for the script to access these options, the following two lines of code must be included in the script: `$options = [System.Console]::ReadLine()   $options = ConvertFrom-Json $options` Afterwards, any one of these variables can be easily accessed: `$options.Login$options.Password   # -> admin and secret` |

### Write a script

See how to [Write a PowerShell Script for Provisioning](../configuration-details/write-fulfill-powershell-script.md) to allow provisioning with this connector.

## Authentication

### Password reset

The PowerShell script manages password reset.

### Credential protection

Data protection can be ensured through:

- [Connection](../../../integrations/toolkit/xml-configuration/connectors/connection.md), configured in
the `appsettings.encrypted.agent.json` file;
- An [Connection](../../../integrations/toolkit/xml-configuration/connectors/connection.md) safe;

 | Attribute | Naming Convention for the Key in Azure Key Vault |
 | --- | --- |
 | Login (optional) | `Connections--<identifier>--Options--Login` |
 | Password (optional) | `Connections--<identifier>--Options--Password` |
 | PowerShellScriptPath | `Connections--<identifier>--PowerShellScriptPath` |

- A [Connection](../../../integrations/toolkit/xml-configuration/connectors/connection.md) able to store
the attributes from the `Options` section that are compatible with <b>cyberark</b>.

Protected attributes are stored inside a safe in <b>cyberark</b>, into an account whose identifier can be retrieved by Identity Manager from `*appsettings.<b>cyberark</b>.agent.json*`.

> For example, consider `Login` and `Password` values stored in the `PowerShellCsv_Account` account:
>
> ```
> *appsettings.<b>cyberark</b>.agent.json*
> {
>   "Connections": {
>     ...
>     "PowerShellCsvFulfillment": {
>       "Options": {
>         "Login": "PowerShellCsv_Account",
>         "Password": "PowerShellCsv_Account"
>       }
>     }
>   }
> }
> ```

