> For the complete documentation index, see [llms.txt](https://docs.poshtools.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.poshtools.com/open-source-tools/powershell-protect/getting-started.md).

# Getting Started

PowerShell Protect can be installed from the PowerShell Gallery.

```powershell
Install-Module PowerShellProtect
```

To install the AMSI provider that is used to audit and block scripts, you will need to run the following command.

{% hint style="info" %}
This command needs to be run as administrator.
{% endhint %}

```powershell
Install-PowerShellProtect
$Configuration = New-PSPConfiguration 
Set-PSPConfiguration -Configuration $Configuration -FileSystem
```

Once installed, the [Default Rules](/open-source-tools/powershell-protect/rules.md#default-rules) will be enabled. You can also enable additional rules using the PowerShell Protect configuration cmdlets.

For example, this configuration will block and audit any script that contains a command with `webrequest` in the name.

```powershell
$Condition = New-PSPCondition -Property "command" -contains -Value "webrequest"
$BlockAction = New-PSPAction -Block
$FileAction = New-PSPAction -File -Format "{applicationName},{rule}" -Path "%temp%\audit.csv" -Name 'File'
$Rule = New-PSPRule -Name "Web Request" -Condition $Condition -Action @($BlockAction, $FileAction)

$Configuration = New-PSPConfiguration -Rule $Rule -Action @($BlockAction, $FileAction)
Set-PSPConfiguration -Configuration $Configuration -FileSystem
```
