Getting Started
  • 📌Patch My PC Docs
  • 🔧Installation Guides
    • Advanced Insights & Patch Insights
      • Release Notes (Advanced Insights)
        • Release Notes (Inventory Extension)
      • Requirements
        • Certificate Requirements
        • Software Requirements
        • Network Requirements
      • Download and Install
        • SSL Certificate Configuration
        • Advanced Insights SQLite Database
        • IIS Configuration selection
        • Install Summary
        • Completion
      • Upgrading Advanced Insights
        • Upgrading to Advanced Insights 2.1 and later from 1.0.x and 2.0.x versions
      • Modify Advanced Insights
        • Modify SSL Certificate
        • Modify Network Port
        • Password reset
        • Modify IIS App Pool Identity
      • Uninstalling Advanced Insights
      • Backup and Restore of your Advanced Insights Configuration
      • SQL Permissions
      • Configuration Manager Permissions
      • First Use Experience
      • Proxy Support
      • Advanced Insights Inventory Extensions
        • Description
        • Custom Client Actions
        • WMI Class Definitions
      • External Services Dell Warranty API
      • External Services HP Warranty (Workforce Experience)
      • External Services Lenovo Warranty API
      • Microsoft Updates Inventory
      • Active Directory Integration & RBAC
      • Active Directory Group to Role Assignment
      • Azure AD (Entra ID) Authentication
      • Requirements for Remote Control
      • Launching Remote Control of a Client
      • Configuration Manager Console Extension
      • Custom Dashboards
        • Creating your first Custom Dashboard
        • Editing a Custom Dashboard
        • Sharing a Custom Dashboard
      • Dashboard Guides
        • Home Page
        • Resources
          • Collections
          • Devices
          • Users
        • Hardware
          • Displays
          • Batteries
          • Storage
          • Graphics Adapters
          • Wireless Adapters
        • Software
          • Applications
          • Client Inventory
          • Software Usage
          • Microsoft 365 Apps
          • ODBC Connections
          • Browser Extensions
        • Operating Systems
          • Dashboard
          • Windows 11 Readiness
          • Local Administrators
          • OS Uptime
          • User Profiles
        • Software Updates
          • Dashboard
          • Updates
          • Update Groups
          • Update Deployments
          • Windows OS
          • Computer Status
          • Microsoft Updates
          • Update Trend
        • Security and Compliance
          • BitLocker
      • Advanced Insights Log Collector
      • IIS Application Pool Identity
      • Two Factor Auth
      • Telemetry Data collected by Advanced Insights
    • Configuration Manager
      • Requirements
      • Download and Install
      • License Key
      • Certificate Configuration
      • Updates
      • ConfigMgr Apps
      • Sync Schedule
      • Alerts
      • Advanced
    • Intune
      • Requirements
      • Download and Install
      • License Key
      • Azure App Registration
      • Intune Apps
      • Intune Updates
      • Sync Schedule
      • Alerts
      • Advanced
    • WSUS Standalone
      • Requirements
      • Download and Install
      • License Key
      • Certificate Configuration
      • Enable Standalone WSUS Mode
      • Updates
      • Sync Schedule
      • Verify Third-Party Updates Appear in WSUS Console
      • Alerts
      • Advanced
    • On-Premises Publisher
      • Release Notes (Publisher)
        • Preview Releases (Publisher)
        • 1.x Releases (Publisher)
      • Reference (Publisher)
        • Telemetry Data collected by Patch My PC On-Premises Publisher
    • Patch My PC Cloud
      • Release Notes (Cloud)
      • Requirements (Cloud)
      • Onboard to Patch My PC Cloud
      • Deployments
        • Deployment Overview
        • Deploy an App
          • General Information (Deployments)
          • Configurations (Deployments)
            • Scripts (Deployments)
            • Install Parameters (Deployments)
            • Dependencies (Deployments)
            • Role Scope Tags (optional)
            • Extra Files (Deployments)
            • Categories (Deployments)
            • ESP Profiles (Deployments)
            • Return Codes (Deployments)
          • Assignments (Deployments)
          • Summary (Deployments)
        • Deploy the same App with multiple configurations
        • Create a Deployment Without Assignments
        • Use a Template in Deployments
        • Update Rings
          • Update Rings Overview
          • How Update Rings Are Created
          • How the Sync Schedule Affects Update Rings
          • How Update Rings Handle New Versions
          • How Update Rings Affect Dependencies
          • Create Update Rings
          • Edit Update Rings
          • View Update Rings
          • Check if an Update Ring has been created
          • Update an Update Ring
          • Convert Existing Deployments to Use Update Rings
          • Delete Update Rings
        • Monitor a Deployment
        • Manage Updates
          • Pause Updates
          • Resume Updates
          • Sync Now
        • Manage Deployments
          • View a Deployment's Properties
          • Edit a Deployment
          • Recreate a Deployment
          • Sort Deployments
          • Delete a Deployment
      • Events (Cloud)
        • Events Overview
        • Search for an Event
        • Filter Events
        • Export Events
        • Sort Events
        • Find more information about an Event
        • Change the number of Events per page
        • Navigate between pages of Events
        • Events Reference
          • General Events Reference
          • Security Events Reference
      • Discovery
        • Discovery Overview
        • Deploy an Unmanaged app
        • Manage Managed Apps
        • Refresh Discovery Data
        • Discovery Managed Apps Reference
      • Administration (Cloud)
        • Manage your Company
          • Enable Preview Features
          • Grant Patch My PC Support access to your portal
          • Delete your Company
          • Recover Your Company
          • Company Reference
        • Manage Users
          • Add a User
          • Using Entra ID Security Groups
            • Add an Entra ID Group
            • View an Entra ID Group's Membership
            • Modify an Entra ID Group
            • Remove an Entra ID Group
          • Modify a User
          • Delete a User
          • Manage Access Requests
            • Approve an Access Request
            • Reject an Access Request
          • Manage Invitations
            • Accept an Invitation
            • Copy an Invitation’s link
            • Resend an Invitation
            • Delete an Invitation
          • User Roles Reference
        • Manage your Environments
          • Manage Intune tenants
          • Manage your License
          • Rename your Environment
        • Manage Connections
          • Add a Connection
          • Verify the Publisher connection
          • Delete a Connection
        • Manage Branding
          • Add Branding
          • Modify Branding
          • Recreate Branding
          • Branding V2
            • Add Branding V2
            • Modify/Recreate Branding V2
            • Delete Branding V2
            • Managing Localizations V2
            • Default Language Notifications
        • Manage Notifications
          • Add a Notification
          • Create a Webhook notification
          • Create a Microsoft Teams Webhook Notification
          • Create a Slack Webhook Notification
          • Create an Email notification
          • Modify a Notification
          • Delete a Notification
          • Notifications Reference
            • Test a Microsoft Teams Webhook Notification
            • Test a Slack Webhook Notification
            • Test an Email Notification
          • Webhooks Reference
            • Create a Microsoft Teams Webhook
            • Create a Slack Webhook
        • Manage Naming Conventions
          • Configure Naming Conventions
          • Modify Naming Conventions
        • Manage the Sync Schedule
        • Manage Deployment Templates
          • Add a Template
          • Edit a Template
          • Configure a Default Template
          • Delete a Template
        • Delete the Patch My PC Cloud Enterprise Application
      • Binary Free Apps
        • Binary Free Apps Overview
        • Deploy a Binary Free App
        • Manage New Version Notifications for a Binary Free App
        • Update a Binary Free App
      • Custom Apps
        • Custom Apps Overview
        • Custom Apps Requirements
        • Onboard to Custom Apps
        • Create a Custom App
          • Upload the Primary Installer
          • Extra Folders or Files (Custom Apps)
          • General Information (Custom Apps)
          • Configuration (Custom Apps)
          • Detection Rules (Custom Apps)
          • Summary (Custom Apps)
        • Publish a Custom App
        • Modify a Custom App
        • Update a Custom App
        • Delete a Custom App
        • Custom Apps Reference
          • Add a Folder Structure to a Custom App
          • Find properties for EXE-Based Installers
          • Uninstall a Custom App
      • Intune Apps
        • Intune Apps Overview
        • Intune Apps Requirements
        • Onboard to Intune Apps
          • Onboard to Intune Apps for Custom Apps users
        • Feature Comparison with Publisher
      • macOS Support
        • Filter by OS
        • Deploy a macOS app
      • Managed Service Provider
        • Managed Service Provider Overview
        • Managed Service Provider Requirements
        • License the Managed Service Provider Feature
        • MSP App Sets
          • Create an App Set
          • Edit an App Set
          • Delete an App Set
        • MSP Custom Apps
          • Create an MSP Custom App
          • View all MSP Custom Apps
          • Deploy an MSP Custom App
          • Edit an MSP Custom App
          • Update an MSP Custom App
          • Delete an MSP Custom App
        • Managed Service Provider Administration
          • Manage MSP Companies
            • Add a Company to Manage (Cloud MSP)
            • Choose a Company to Manage (Cloud MSP)
            • Remove a Company from being Managed (Cloud MSP)
          • Manage MSP Users
          • Manage MSP Deployments
          • Manage MSP Events
          • Manage MSP Notifications
        • Non-Replicating MSP Settings
      • Troubleshooting (Cloud)
        • Onboarding
          • “Need admin approval” message when onboarding
          • “Permissions requested” dialog box not shown during Onboarding
        • App Catalog
          • Why is the "Delete" option greyed out for an app?
        • Binary Free Apps
          • “Unable to verify the file you are trying to upload”
        • Branding
          • Why don’t I see the “Branding” node in the portal?
        • Company
          • "Error - Claim Ownership Failed"
          • "Tenant recovery has been disabled for this account"
          • Why can’t I access my Company?
          • Why can’t I Delete my Company?
        • Custom Apps
          • General Custom Apps Troubleshooting
        • Dependencies
          • Why is an app not shown in the “App Dependencies” dropdown?
        • Deployments
          • “500 Internal Server Error” when adding an assignment - why?
          • “A deployment with the same name <deployment_name> already exists”
          • Browser Crashes when uploading a large number of files using the Patch My PC Cloud portal
          • “Group not found” shown for an Assignment of a successful deployment
          • "These settings are locked after deployment to prevent installation issues"
          • Troubleshooting an Intune Apps Deployment
          • "TypeError: Failed to fetch" error when trying to upload a Pre or Post Script
          • Why do I see a yellow exclamation mark ("!") beside a deployment?
          • Why is the “Deploy” button greyed out?
          • Why is “Edit” Unavailable for a Deployment?
        • Discovery
          • Why don’t I see the “Discovery” node in the portal?
          • Why is the “Edit” button disabled beside a Managed App?
        • Environments
          • “Intune connection with the same Id found in another environment”
          • “Need admin approval” message when connecting to Intune
          • Why don't I see the ellipsis to edit my Environment or License?
        • Events
          • Why don’t I see the “Events” node in the portal?
        • Intune
          • What happens if the Patch My PC Cloud Enterprise App is deleted?
        • Licensing
          • "Your license doesn't match the specified SKU"
          • “Your trial has expired”
          • “Your trial license expires in xx days”
        • Managed Service Provider
          • “Customer has active connections. Please disconnect them first in order to delete the company”
          • “Error - Intune connection with the same Id found in another environment!”
          • "Unable to disconnect this customer as they do not have a user with the Full Admin..."
        • Notifications
          • Why don’t I see the “Notifications” node in the portal?
        • Sign in
          • “The service is currently unavailable in the <region_code> region”
        • Update Rings
          • "Error - Editing is not allowed until all rings are created after the configured delay."
        • Users
          • “Unable to change the role of this group as it was not found in Entra ID” error
          • Why don’t I see the “Users” node in the portal?
          • Why is the “Add Group” button unavailable?
          • Why is the “Add Group” button unavailable on the “Available Groups” page?
          • “You currently have only one user with Access Management privileges”
      • Reference (Cloud)
        • About the Patch My PC Code-Signing Certificate
          • Using a Custom Configuration Policy
          • Using a script
        • App Catalog Icon Reference
        • Email Reference
          • Example Access Request Email
          • Example Access Approved Email
          • Example Access Rejected Email
          • Example Account Recovery Email
          • Example Binary Free App Update Email
          • Example Binary Free App Successfully Updated Email
          • Example Invitation Email
          • Example Updates Report Email
        • Entra ID Reference
          • Create an App Registration in Entra ID
          • Delete an App Registration in Entra ID
        • Intune Reference
          • Check App Categories
          • Check Detection Rules
          • Check ESP Profiles
          • Check Return Codes
          • Check Scope Tag Assignments
        • Permissions Reference
          • Permissions required for Patch My PC Cloud
          • Permissions required for Intune Apps
        • Telemetry Data collected by Patch My PC Cloud
        • Unsupported File Names and Extensions
      • Product Limits (Cloud)
      • Glossary (Cloud)
      • Contacting Support
    • Product Reference
      • Language Support in Publisher and PMPC Cloud
  • 💁‍♂️ Get Help
    • Open a Support Case
    • Live Demo, Setup & Review Calls
      • Book a Live Demo
      • Book a Guided Setup Call
      • Book an Environment Review Call
    • Log Reference Guide
    • MEM Patching Optimizer
      • Requirements
      • Download and Install
      • Running Tests
      • Updates
    • Return on Investment Tool
  • 🔁Release History
    • Advanced Insights Releases
      • Inventory Extension Releases
    • Patch My PC Cloud Releases
    • Publisher Releases
      • Publisher 1.x Releases
      • Preview Releases
    • ROI Tool Releases
  • 🤝Resources
    • Patch My PC Website
    • Download Installer
    • FAQ
    • Homepage
    • Roadmap
    • UserVoice
    • About Us
Powered by GitBook

Links

  • Feedback or comments?
  • Main Website

© Patch My PC 2011 - 2025

On this page
  • Pre-Install Script
  • Post-Install Script
  • Pre-Uninstall Script
  • Post-Uninstall Script

Was this helpful?

Export as PDF
  1. Installation Guides
  2. Patch My PC Cloud
  3. Deployments
  4. Deploy an App
  5. Configurations (Deployments)

Scripts (Deployments)

PreviousConfigurations (Deployments)NextInstall Parameters (Deployments)

Last updated 30 minutes ago

Was this helpful?

Applies to: Patch My PC Cloud

Note

Using the Scripts tool is optional.

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

Note

  • 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

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 section of .

To add a script:

  1. Click the Scripts tab to expose the configurable settings.

  2. Click Add beside the relevant script option to add a script, then configure the required settings in the relevant sections as detailed below.

Pre-Install Script

To add a Pre-Install script:

  1. Click Add beside the Pre-Install option.

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

    The Add Pre-Install Script page is populated with the imported script.

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

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

  5. In the script editor, type your script.

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.

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

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.

Important

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

  1. Check the Don’t attempt software update if the pre script returns an exit code other than 0 or 3010 checkbox if you don’t want the app to be installed if the pre-script returns an exit code other than 0 or 3010.

    If you do not check this checkbox, we will attempt to install the app regardless of the exit code returned by the pre-install script.

  2. Check the Run the pre-update script before performing any auto-close or skip process checks checkbox if you want to run the pre-install script before the conflicting process notification is displayed (if relevant). If you do not check this checkbox, we will run the pre-install script after the conflicting process notification.

  3. Click Save to save your script.

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

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.

Post-Install Script

To add a Post-Install script:

  1. Click Add beside the Post-Install option.

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

    The Add Post-Install Script page is populated with the imported script.

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

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

  5. In the script editor, type your script.

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.

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

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.

%ReturnCode% is currently only supported on post-scripts.

Important

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

  1. Click Save to save your script.

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

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.

Pre-Uninstall Script

To add a Pre-Uninstall script:

  1. Click Add beside the Pre-Uninstall option.

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

    The Add Pre-Uninstall Script page is populated with the imported script.

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

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

  5. In the script editor, type your script.

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.

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

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.

Important

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

  1. Check the Don’t attempt software uninstall if the pre script returns an exit code other than 0 or 3010 checkbox if you don’t want the app to be uninstalled if the pre-script returns an exit code other than 0 or 3010. If you do not check this checkbox, we will attempt to uninstall the app regardless of the exit code returned by the pre-install script.

  2. Check the Run the pre-uninstall script before performing any auto-close or skip process checks checkbox if you want to run the pre-uninstall script before the conflicting process notification is displayed (if relevant). If you do not check this checkbox, we will run the pre-uninstall script after the conflicting process notification.

  3. Click Save to save your script.

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

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.

Post-Uninstall Script

To add a Post-Uninstall script:

  1. Click Add beside the Post-Uninstall option.

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

    The Add Post-Uninstall Scripts page is populated with the imported script.

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

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

  5. In the script editor, type your script.

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.

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

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.

%ReturnCode% is currently only supported on post-scripts.

Important

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

  1. Click Save to save your script.

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

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.


Otherwise, click on the relevant tab under Tools to configure the required settings, which are explained in the relevant article.

- a script that can be run before the installer runs.

- a script that can be run after the installer runs.

- a script that can be run before the uninstaller runs.

- a script that can be run after the uninstaller runs.

If you do not want to configure any of the optional tabs under the Tools section, click Next to move to the tab.

🔧
Assignments
Pre-Install Script
Post-Install Script
Pre-Uninstall Script
Post-Uninstall Script
"TypeError: Failed to fetch" error when trying to upload a Pre or Post Script
Resolution
Clicking the "Scripts" tab to expose the configurable settings
Clicking “Add” beside the “Pre-Install” option
Clicking “Import” to import an existing script
The “Add Pre-Install Script” page is populated with the imported script.
Entering a unique name for the script in the “Script Name” field
Selecting the type of script from the “Script Format” dropdown.
Typing your script in the Script Editor
Entering any arguments you want to provide to the script by specifying them in the “Arguments” field
Checking the “Don’t attempt software update if the pre script returns an exit code other than 0 or 3010” checkbox
	Checking the “Run the pre-update script before performing any auto-close or skip process checks” checkbox
“Configurations” tab re-displayed with the name of the configured script beside it
Clicking “Add” beside the “Post-Install” option
Clicking “Import” to import an existing script
“Add Post-Install Script” page is populated with the imported script.
Entering a unique name for the script in the “Script Name” field
Selecting the type of script from the “Script Format” dropdown.
Typing your script in the Script Editor
Entering any arguments you want to provide to the script by specifying them in the “Arguments” field
Clicking “Save” to save your script
“Configurations” tab re-displayed with the name of the configured script beside it
Clicking “Add” beside the “Pre-Uninstall” option
Clicking “Import” to import an existing script
“Add Pre-Uninstall Script” page is populated with the imported script.
Entering a unique name for the script in the “Script Name” field
Selecting the type of script from the “Script Format” dropdown.
Entering any arguments you want to provide to the script by specifying them in the “Arguments” field
Checking the “Don’t attempt software uninstall if the pre script returns an exit code other than 0 or 3010” checkbox
Checking the “Run the pre-uninstall script before performing any auto-close or skip process checks” checkbox
Clicking “Save” to save your script
“Configurations” tab re-displayed with the name of the configured script beside it
Clicking “Add” beside the “Post-Uninstall” option
Clicking “Import” to import an existing script
“Add Post-Uninstall Script” page is populated with the imported script.
Entering a unique name for the script in the “Script Name” field
Selecting the type of script from the “Script Format” dropdown.
Typing your script in the Script Editor
Entering any arguments you want to provide to the script by specifying them in the “Arguments” field
Clicking “Save” to save your script
“Configurations” tab re-displayed with the name of the configured script beside it