> For the complete documentation index, see [llms.txt](https://leo4j.gitbook.io/amnesiac/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://leo4j.gitbook.io/amnesiac/sessions/scripts-loading/patch-and-patchnet.md).

# Patch and PatchNet

AMSI Patching

#### **`Patch` Command:**&#x20;

This command patches AMSI to allow scripts written in pure powershell language to execute without interference from AMSI.

**Please Note:** AMSI patching may fail against AV vendors other than Defender.

<figure><img src="https://1622982705-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxZYmkSsz78lM8RvvHGKL%2Fuploads%2F07xjgDH8RKQ5seELNDhi%2Fimage.png?alt=media&amp;token=93b60973-ff96-4594-a93e-e0f77061ec6c" alt=""><figcaption></figcaption></figure>

#### **`PatchNET` Command**

Some PowerShell scripts, like Rubeus, load .NET assemblies via \[System.Reflection.Assembly]::Load(). AMSI can catch binaries loaded through this method, making traditional AMSI bypasses ineffective. To address this, run the `Patch` command first then the `PatchNET` command before loading them.

**Please Note:** AMSI patching may fail against AV vendors other than Defender.

<figure><img src="https://1622982705-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxZYmkSsz78lM8RvvHGKL%2Fuploads%2FLTK1GzJas8MrKgD64jPE%2Fimage.png?alt=media&amp;token=24aba7f2-e74b-4bde-a4d9-4009e5720062" alt=""><figcaption></figcaption></figure>
