# Configure Scripts in a Patch My PC Cloud Deployment

*Applies to: Patch My PC Cloud*

{% hint style="info" %}
**Note**

Using the **Scripts** tool is optional.
{% endhint %}

The **Scripts** tool in the Patch My PC (PMPC) Cloud deployment wizard allows you to configure settings for install and uninstall scripts.

This includes regular PowerShell (.ps1) scripts as well as PSADT scripts, which can be specified directly in our Portal without having to upload the required PSADT module files separately.

{% hint style="info" %}
**Note**

Although we support both PSADT v3 and V4, we recommend using V4 whenever possible.

Also:

* Scripts will be run in the same context as the application.
* Each install script is limited to 1 MB per script, with a total size limit of 4 MB for all scripts.
* There is a limit of 50,000 characters per script.

We currently support the following script types:

* .BAT
* .CMD
* .PS1
* .VBS
  {% endhint %}

{% hint style="danger" %}
**Important**

Currently, scripts containing `"${env:ProgramFiles(x86)}"` or `"${env:ProgramFiles}"` cannot be uploaded as Cloudflare is falsely identifying them as a false positive related to Log4j exploits. We are actively working with them to resolve this, but as this is outside our control, we cannot provide an estimated resolution time.

To work around this issue, see the [Resolution](https://docs.patchmypc.com/troubleshoot/deployments/typeerror-failed-to-fetch-error-when-trying-to-upload-a-pre-or-post-script-in-cloud#resolution) section of ["TypeError: Failed to fetch" error when trying to upload a Pre or Post Script](https://docs.patchmypc.com/patch-my-pc-cloud/troubleshoot/deployments/typeerror-failed-to-fetch-error-when-trying-to-upload-a-pre-or-post-script-in-cloud).
{% endhint %}

To add a script:

1. Add the [**Scripts** tool](https://docs.patchmypc.com/patch-my-pc-cloud/deployments/deploy-app/configurations-tab/..#adding-additional-tools).
2. Click the **Scripts** tool.

<figure><img src="https://3773699522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MX7dvS0r_4fc0AikgJS%2Fuploads%2FgfQ5ivlmKNJDOMkCt7kc%2Fimage.png?alt=media&#x26;token=8af1eea0-111f-4078-89f9-78a0f90dfb9b" alt="Clicking the &#x27;Scripts&#x27; tool" width="563"><figcaption></figcaption></figure>

{% hint style="info" %}
**Note**

If the app includes our recommended scripts, you will see the **Customer Scripts | PMPC Scripts** toggle shown above the **Install Scripts** section.

See [PMPC Scripts](https://docs.patchmypc.com/patch-my-pc-cloud/deployments/technical-references/use-pmpc-scripts) for more details on the options you have for managing these scripts.
{% endhint %}

3. Click **Add** beside the relevant script option to add a script, then configure the required settings as per the relevant articles:

* [Pre-Install Script](https://docs.patchmypc.com/patch-my-pc-cloud/deployments/deploy-app/configurations-tab/additional-tools/scripts/pre-install-scripts) - a script that can be run before the installer runs.
* [Post-Install Script](https://docs.patchmypc.com/patch-my-pc-cloud/deployments/deploy-app/configurations-tab/additional-tools/scripts/post-install-scripts) - a script that can be run after the installer runs.
* [Pre-Uninstall Script](https://docs.patchmypc.com/patch-my-pc-cloud/deployments/deploy-app/configurations-tab/additional-tools/scripts/pre-uninstall-scripts) - a script that can be run before the uninstaller runs.
* [Post-Uninstall Script](https://docs.patchmypc.com/patch-my-pc-cloud/deployments/deploy-app/configurations-tab/additional-tools/scripts/post-uninstall-scripts) - a script that can be run after the uninstaller runs.

<figure><img src="https://3773699522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MX7dvS0r_4fc0AikgJS%2Fuploads%2F7JrhH0hs3UAn42n9afos%2Fimage.png?alt=media&#x26;token=86d75e00-b850-4974-aa39-94342ec78192" alt="&#x27;Scripts&#x27; tool settings" width="563"><figcaption></figcaption></figure>

{% hint style="info" %}
**Note**

If you upload [Extra Files](https://docs.patchmypc.com/patch-my-pc-cloud/deployments/deploy-app/configurations-tab/additional-tools/extra-files) as part of your Patch My PC (PMPC) Cloud Deployment, you can reference those files in any of the [Scripts](https://docs.patchmypc.com/patch-my-pc-cloud/deployments/deploy-app/configurations-tab/additional-tools/scripts) in the same deployment by building a path relative to the script's current location. See [Referencing Extra Files in Scripts](https://docs.patchmypc.com/patch-my-pc-cloud/deployments/technical-references/reference-external-scripts) for more information.

Also, if any PSADT commands are detected in any of the scripts configured in the **Scripts** section, a warning is displayed about ensuring that any devices to which this deployment is assigned have at least .NET Framework 4.7.2 installed.

![PSADT warning](https://3773699522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MX7dvS0r_4fc0AikgJS%2Fuploads%2FROJw3QJq5b4qnPasNwOx%2Fimage.png?alt=media\&token=26baccae-eb3e-46dc-95b9-701bfdda3e97)

If this warning appears, check the **Enable PSADT Module** checkbox (available only if PSADT commands are detected), which will ensure the PSADT Toolkit is uploaded to Intune when this deployment is created.

If this warning is not displayed, you should not check the **Enable PSADT Module** checkbox.
{% endhint %}

{% hint style="danger" %}
**Important**

Checking the **Enable PSADT Module** checkbox causes the following behaviors:

* When [creating a deployment](https://docs.patchmypc.com/patch-my-pc-cloud/deployments/deploy-app):
  * If a PSADT script is included and you have not manually interacted with the checkbox, it will be **automatically enabled**.
  * If you manually change the checkbox state, your selection will be preserved.
* When [editing a deployment](https://docs.patchmypc.com/patch-my-pc-cloud/deployments/manage-deployments/edit):
  * The checkbox is treated as **manually configured**, and its state will not be automatically changed.
  * If a PSADT script is added during edit, the checkbox will **not be auto-enabled** and must be adjusted manually if needed.
    {% endhint %}

## Next Steps

If you do not want to configure any additional settings, click **Next** to move to the [Assignments](https://docs.patchmypc.com/patch-my-pc-cloud/deployments/deploy-app/assignments-tab) tab.

Otherwise, navigate to the relevant tool to configure the required settings, which are explained in the relevant section.


---

# 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.patchmypc.com/patch-my-pc-cloud/deployments/deploy-app/configurations-tab/additional-tools/scripts.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.
