# Using Post-Install Scripts in a Patch My PC Cloud Deployment

*Applies to: Patch My PC Cloud*

A *Post-Install Script* is a script that can be run after the installer runs.

To add a **Post-Install** script:

1. Click **Add** beside the **Post-Install** option.

<figure><img src="https://3773699522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MX7dvS0r_4fc0AikgJS%2Fuploads%2FbMQ2gLDfKyvhAXJnTia6%2Fimage.png?alt=media&#x26;token=7e79ea82-7ee0-4df2-a993-a2c0ec4cdde0" alt="Clicking “Add” beside the “Post-Install” option" width="419"><figcaption></figcaption></figure>

The **Add Pre-Install Script** page is shown, highlighting that the default **Script Format** is **.ps1**, with built-in support for PSADT functions.&#x20;

2. To import an existing script, click **Import**, browse to the location containing the script, and select it.

<figure><img src="https://3773699522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MX7dvS0r_4fc0AikgJS%2Fuploads%2FHJuwvjILuquKZ1nwS37N%2Fimage.png?alt=media&#x26;token=465b5226-d6b3-47a1-8206-45fb77476d9a" alt="Clicking &#x27;Import&#x27; to import an existing script" width="563"><figcaption></figcaption></figure>

The **Script Name** field is populated with the filename of the script selected, and the **Add Post-Install Script** page is populated with the imported script.

<figure><img src="https://3773699522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MX7dvS0r_4fc0AikgJS%2Fuploads%2FwC8E8AqrgaVnG5Fd1h11%2Fimage.png?alt=media&#x26;token=5af9d408-fffd-407a-ae8d-bbdea5808ca9" alt="&#x27;Add Post-Install Script&#x27; page is populated with the imported script." width="563"><figcaption></figcaption></figure>

3. To manually add a script, enter a unique name for the script in the **Script Name** field.

<figure><img src="https://3773699522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MX7dvS0r_4fc0AikgJS%2Fuploads%2FuShKfRpj2jK6WXAfmKM4%2Fimage.png?alt=media&#x26;token=2a6bfb1c-c6a7-478a-8da1-09d9ad05849b" alt="Entering a unique name for the script in the &#x27;Script Name&#x27; field" width="563"><figcaption></figcaption></figure>

4. Select the type of script from the **Script Format** dropdown.

<figure><img src="https://3773699522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MX7dvS0r_4fc0AikgJS%2Fuploads%2FUuNYMHbqYEwrvMW9eNHN%2Fimage.png?alt=media&#x26;token=e59cd3aa-311d-48a7-b9e9-9e374728de72" alt="Selecting the type of script from the &#x27;Script Format&#x27; dropdown." width="563"><figcaption></figcaption></figure>

5. In the script editor, type your script.

<figure><img src="https://3773699522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MX7dvS0r_4fc0AikgJS%2Fuploads%2FBwDIYY3F8DuTm7wk74Cu%2Fimage.png?alt=media&#x26;token=153daecc-46c6-4fdd-9396-6529ed946c70" alt="Typing your script in the Script Editor" width="563"><figcaption></figcaption></figure>

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

We currently have a limit of 50,000 characters per script. Use the **Number of characters used** counter to keep track of the number of characters you’ve entered in the script editor.
{% endhint %}

{% hint style="success" %}
**Tip**

Under the script editor, we include example syntax to help you understand the required syntax for referencing any additional files you've uploaded, which updates depending on the **Script Format** selected.&#x20;
{% endhint %}

6. In the **Arguments** field, enter any arguments you want to provide to the script.

<figure><img src="https://3773699522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MX7dvS0r_4fc0AikgJS%2Fuploads%2FTszu99xf22RUdiSeZkqH%2Fimage.png?alt=media&#x26;token=97ae8bea-9831-435a-ba2c-4506617d4789" alt="Entering any arguments you want to provide to the script by specifying them in the &#x27;Arguments&#x27; field" width="563"><figcaption></figcaption></figure>

{% hint style="success" %}
**Tip**

You can use variable names as arguments, provided they are enclosed by percentage signs (`%`). We provide common variables under this field, which you can add by clicking the plus (`+`) symbol or relevant variable name.

&#x20;`%ReturnCode%` is currently only supported on post-scripts.
{% endhint %}

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

Using script Arguments is currently unsupported when deploying an app to macOS.

Also, if you add any PSADT scripts to your deployments, you need to ensure .NET version 4.7.2 is installed on any devices to which this app will be deployed.
{% endhint %}

7. Click **Save** to save your script.

<figure><img src="https://3773699522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MX7dvS0r_4fc0AikgJS%2Fuploads%2FXnCcf58viOY7r8yHp9tq%2Fimage.png?alt=media&#x26;token=47ea3ccc-fada-443c-83aa-f140811db6e8" alt="Clicking &#x27;Save&#x27; to save your script" width="563"><figcaption></figcaption></figure>

The **Configurations** tab is re-displayed with the name of the configured script beside it.

<figure><img src="https://3773699522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MX7dvS0r_4fc0AikgJS%2Fuploads%2FeaT4T427UwoN6GFuAD9i%2Fimage.png?alt=media&#x26;token=74f4a528-ed94-41d7-bf2b-04a60e85104e" alt="“Configurations” tab re-displayed with the name of the configured script beside it" width="418"><figcaption></figcaption></figure>

{% hint style="success" %}
**Tip**

You can click **Edit** to edit a script or its settings. You can also click the red “`x`” beside a script to delete it.
{% 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.
