{"id":23287,"date":"2023-05-08T09:52:01","date_gmt":"2023-05-08T04:22:01","guid":{"rendered":"https:\/\/www.hexnode.com\/blogs\/?p=23287"},"modified":"2023-05-08T10:33:16","modified_gmt":"2023-05-08T05:03:16","slug":"using-pre-post-app-installation-scripts","status":"publish","type":"post","link":"https:\/\/www.hexnode.com\/blogs\/using-pre-post-app-installation-scripts\/","title":{"rendered":"Using pre\/post app installation scripts"},"content":{"rendered":"<p>\u201cAn error occurred while installing the application.\u201d<\/p>\n<p>\u201cThe application can\u2019t be opened.\u201d<\/p>\n<p>These words are one of the worst nightmares of all IT admins. Enough to drive someone into a state of confusion, thinking about what they missed. In addition, every app will have its own set of requirements to run correctly. Making sure all these prerequisites are satisfied fulfilled in all devices can be a daunting task. Being an IT admin is not easy?. \u2018Pat pat\u2019 to you folks.<\/p>\n<p>Alright, let&#8217;s say you managed to install the application. Is the job done? I\u2019m afraid not. You might have to ensure all the necessary features are turned on before launching the app. Seems like too much work? Getting an application to work correctly shouldn\u2019t be this hard, right? So, what is the solution?<\/p>\n<p><em>(Read in Al Pacino\u2019s voice)<\/em> Say hello to my little friend- pre and post app install scripts.<\/p>\n<h2>Scripting made simple<\/h2>\n<p>Since my \u201ccatchy\u201d intro is over, let&#8217;s look at what precisely are these pre and post app installation scripts and why we might need them.<\/p>\n    \t\t<div class=\"hts-messages hts-messages--info    \"   >\r\n    \t\t\t    \t\t\t    \t\t\t\t<p>\r\n    \t\t\t\t\tA script is a series of commands written in a scripting language that details the operations you want to perform on your computer devices and automatically executes it on the devices without any manual intervention. IT admins will have to manually administrate these tasks one by one on each device. Hence, IT admins majorly turn to scripts to execute specific routines and time-consuming operations.    \t\t\t\t<\/p>\r\n    \t\t\t    \t\t\t\r\n    \t\t<\/div><!-- \/.ht-shortcodes-messages -->\r\n    \t\t\n<p>Pre\/post app installation scripts is a new feature for macOS devices, available now in the Hexnode portal. This feature allows you to customize your enterprise app installation process. For example, you can add custom-made scripts as pre-install scripts and post-install scripts while pushing an application management policy into the devices. Pre-install scripts run before the app installation, and post-install scripts run once the installation process is complete.<\/p>\n<h2>Knowing more about pre\/post app install scripts<\/h2>\n<h3>Pre-install scripts<\/h3>\n<p>Pre-install scripts perform an action before installation occurs. For example, IT admins can use it to set up all the necessary prerequisites before executing the dmg\/pkg file that installs the application. If the pre-install script fails to execute, it will cease the installation process and send an error message to the server.<\/p>\n<p>Before installing your applications, you might have to perform cleanup tasks such as clearing all the cached data. Let\u2019s see how you can automate this process by executing a bash script for cleaning cache data as a pre-install script.<\/p>\n<div class=\"copy-code-download\">\n<pre class=\"theme:github font:monospace font-size:15 line-height:32 toolbar:1 show-plain:3 lang:sh decode:true\" title=\"Script for clearing all cache\">#!\/bin\/bash\r\n\r\nUSER=`stat -f%Su \/dev\/console` \r\n\r\n#System Caches\r\nsudo mv \/private\/var\/log\/privoxy \/private\/var\/privoxy &gt; \/dev\/null 2&gt;&amp;1\r\nsudo \/bin\/rm -rf \/private\/var\/log\/* &gt; \/dev\/null 2&gt;&amp;1\r\nsudo mv \/private\/var\/privoxy \/private\/var\/log\/privoxy &gt; \/dev\/null 2&gt;&amp;1\r\n\r\n#System Caches\r\nsudo \/bin\/rm -rf \/Users\/$USER\/Library\/Logs\/* &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Library\/Logs\/DiagnosticReports\/*.* &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/private\/var\/tmp\/com.apple.messages &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Users\/$USER\/Library\/Caches\/* &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/private\/var\/db\/diagnostics\/*\/* &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Library\/Logs\/DiagnosticReports\/ProxiedDevice-Bridge\/*.ips &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Users\/$USER\/Library\/Application\\ Support\/CrashReporter\/* &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/private\/tmp\/gzexe* &gt; \/dev\/null 2&gt;&amp;1\r\n\r\n#Safari Caches\r\nsudo \/bin\/rm -rf \/Users\/$USER\/Library\/Containers\/com.apple.Safari\/Data\/Library\/Caches\/* &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/private\/var\/folders\/ry\/*\/*\/com.apple.Safari\/com.apple.Safari\/com.apple.metal\/*\/libraries.data &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/private\/var\/folders\/ry\/*\/*\/com.apple.Safari\/com.apple.Safari\/com.apple.metal\/*\/libraries.maps &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Users\/$USER\/Library\/Containers\/io.te0.WebView\/Data\/Library\/Caches\/WebKit &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Users\/$USER\/Library\/Safari\/History.db* &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Users\/$USER\/Library\/Safari\/RecentlyClosedTabs.plist &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Users\/$USER\/Library\/Safari\/CloudHistoryRemoteConfiguration.plist &gt; \/dev\/null 2&gt;&amp;1\r\n\r\n#Chrome Caches\r\nChromePath=\"\/Applications\/Google Chrome.app\"\r\nif [[ -d $ChromePath ]]; then\r\nsudo \/bin\/rm -rf \/Users\/$USER\/Library\/Application\\ Support\/Google\/Chrome\/*\/GPUCache\/* &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Users\/$USER\/Library\/Application\\ Support\/Google\/Chrome\/*\/Storage\/ext\/*\/def\/GPUCache\/* &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Users\/$USER\/Library\/Application\\ Support\/Google\/Chrome\/*\/*-journal &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Users\/$USER\/Library\/Application\\ Support\/Google\/Chrome\/*\/databases\/*-journal &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Users\/$USER\/Library\/Application\\ Support\/Google\/Chrome\/*\/Visited\\ Links &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Users\/$USER\/Library\/Application\\ Support\/Google\/Chrome\/*\/Top\\ Sites &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Users\/$USER\/Library\/Application\\ Support\/Google\/Chrome\/*\/History\\ Provider\\ Cache &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Users\/$USER\/Library\/Application\\ Support\/Google\/Chrome\/*\/Current\\ Tabs &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Users\/$USER\/Library\/Application\\ Support\/Google\/Chrome\/*\/Network\\ Action\\ Predictor &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Users\/$USER\/Library\/Application\\ Support\/Google\/Chrome\/*\/*.ldb &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Users\/$USER\/Library\/Application\\ Support\/Google\/Chrome\/*\/*.log &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Users\/$USER\/Library\/Application\\ Support\/Google\/Chrome\/*\/Extension\\ State\/* &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Users\/$USER\/Library\/Application\\ Support\/Google\/Chrome\/*\/Session\\ Storage\/* &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Users\/$USER\/Library\/Application\\ Support\/Google\/Chrome\/*\/Current\\ Session &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Users\/$USER\/Library\/Application\\ Support\/Google\/Chrome\/*\/Storage\/ext\/* &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Users\/$USER\/Library\/Application\\ Support\/Google\/Chrome\/*\/*\/Cache &gt; \/dev\/null 2&gt;&amp;1\r\nfi\r\n\r\n#Clean Download History\r\nsudo sqlite3 ~\/Library\/Preferences\/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent' &gt; \/dev\/null 2&gt;&amp;1\r\n\r\n#Clean Terminal History\r\nsudo \/bin\/rm -rf \/Users\/$USER\/.bash_sessions\/* &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Users\/$USER\/.bash_history &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Users\/$USER\/.zsh_sessions\/* &gt; \/dev\/null 2&gt;&amp;1 &amp; sudo \/bin\/rm -rf \/Users\/$USER\/.zsh_history &gt; \/dev\/null 2&gt;&amp;1\r\n\r\n#Applications Caches\r\nfor x in $(ls ~\/Library\/Containers\/) \r\ndo \r\n    echo \"Cleaning ~\/Library\/Containers\/$x\/Data\/Library\/Caches\/\"\r\n    rm -rf ~\/Library\/Containers\/$x\/Data\/Library\/Caches\/*\r\ndone\r\n\r\necho done<\/pre>\n<\/div>\n<p>When added as the pre-install script, this bash script clears the system cache, browser cache, user cache, download history, and terminal history before app installation.<\/p>\n<p>You can also use pre-install scripts to do other cleanup tasks, such as removing licensing and clearing database files. Apart from this, you can use pre-install scripts to run configuration files to configure applications automatically during installation. When installation occurs, the installer finds the configuration files already placed to facilitate this process.<\/p>\n<h3>Post-install scripts<\/h3>\n<p>The Post-install script runs after the execution of the dmg\/pkg\/mpkg file. You can use it for applying configurations after the software completes the installation. Tasks that would typically be prompted for the user to resolve before running the app can be automated by using these scripts.<\/p>\n<p>Consider the situation where the user has to launch the app you just installed every time they turn on their devices. Having these apps automatically opened as soon as the user logs in will be convenient. Again, you can deploy a script for this as the post-install script to your device fleet.<\/p>\n<div class=\"copy-code-download\">\n<pre class=\"theme:github font:monospace font-size:15 line-height:32 toolbar:1 show-plain:3 lang:default decode:true \" title=\"Script for launching an app automatically\">#!\/bin\/bash\r\ntouch '\/Library\/LaunchAgents\/com.app_name.plist'\r\ncat &gt; \/Library\/LaunchAgents\/com.app_name.plist &lt;&lt;EOF\r\n\r\n&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;!DOCTYPE plist PUBLIC \"-\/\/Apple\/\/DTD PLIST 1.0\/\/EN\" \"http:\/\/www.apple.com\/DTDs\/PropertyList-1.0.dtd\"&gt;\r\n&lt;plist version=\"1.0\"&gt;\r\n&lt;dict&gt;\r\n\t&lt;key&gt;KeepAlive&lt;\/key&gt;\r\n\t&lt;false\/&gt;\r\n\t&lt;key&gt;Label&lt;\/key&gt;\r\n\t&lt;string&gt;com.app_name.plist&lt;\/string&gt;\r\n\t&lt;key&gt;Program&lt;\/key&gt;\r\n\t&lt;string&gt;\/System\/Applications\/app_name.app\/Contents\/MacOS\/app_name&lt;\/string&gt;\r\n\t&lt;key&gt;RunAtLoad&lt;\/key&gt;\r\n\t&lt;true\/&gt;\r\n&lt;\/dict&gt;\r\n&lt;\/plist&gt;<\/pre>\n<\/div>\n<p>Replace <em>app_name<\/em> in the script with the name of the application you require to launch automatically and specify the full path of the executable file for the application under the key. This script will create a launch agent for the specified app in <strong>\/Library\/LaunchAgents<\/strong> and run for every user account upon logging in.<\/p>\n<p>You can also set up custom app configurations, Wi-Fi settings, VPN settings, and so on by post-install scripting.<\/p>\n<h3>Audit scripts<\/h3>\n<p>An audit script checks the installation status of the enterprise app. The script can check for required files, settings, apps and more to find all possible errors. The audit script would check for the presence of an app at the specified location. If it is not present, the script will prompt Hexnode to reinstall it.<br \/>\n<div class=\"next_blog\"><div class=\"post-next\"><div class=\"hex_blog_box_parent\"><div class=\"blog_warp_next\"><div class=\"next_blog_thumb\" style=\"background-image:url(https:\/\/cdn.hexnode.com\/blogs\/wp-content\/uploads\/2022\/03\/The-ultimate-guide-to-Mac-shell-scripting.png?format=webp)\"><\/div><div class=\"next_post_content\"><div class=\"center_box\"><h4>The ultimate guide to Mac shell scripting<\/h4><p>Learn how to create and run a macOS shell script, and review the common shell commands.<\/p><\/div><\/div><\/div><a class=\"hex_blog_box_link hn-cta__blogs--blog-box\" href=\"https:\/\/www.hexnode.com\/blogs\/the-ultimate-guide-to-mac-shell-scripting\/?utm_source=hexnode_blog_pre_post_app_install_scripts&utm_medium=referral&utm_campaign=blog_box\" aria-label=\"The ultimate guide to Mac shell scripting\"><\/a><\/div><\/div><\/div><\/p>\n<h2>Configuring pre\/post app installation scripts<\/h2>\n<p>Configuring pre-install, post-install and audit scripts using Hexnode won\u2019t take much time if you have your apps and scripts in hand. Feel free to check out Hexnode\u2019s <a href=\"https:\/\/www.hexnode.com\/mobile-device-management\/help\/sample-script-repository\/?utm_source=hexnode_blog_pre_post_app_install_scripts&amp;utm_medium=referral&amp;utm_campaign=internal_link\">sample script repository<\/a> if you need help creating your scripts.<\/p>\n    \t\t<div class=\"hts-messages hts-messages--info    \"   >\r\n    \t\t\t    \t\t\t    \t\t\t\t<p>\r\n    \t\t\t\t\t<\/p>\n<h4>Pre-requisites<\/h4>\n<ul>\n<li>Works on macOS 10.11+.<\/li>\n<li>Supported file formats include Perl (.pl), Bash (.sh), Shell (.sh), C Shell (.csh), Zsh (.zsh), Korn Shell (.ksh), Hypertext Preprocessor (.php), Ruby (.rb), and Python (.py).<\/li>\n<li>The binary required to run the script must be installed on the Mac.<\/li>\n<li>The latest version of the Hexnode MDM app should be installed on the device.<\/li>\n<\/ul>\n<p>    \t\t\t\t<\/p>\r\n    \t\t\t    \t\t\t\r\n    \t\t<\/div><!-- \/.ht-shortcodes-messages -->\r\n    \t\t\n<p>To configure your app installation,<\/p>\n<ol>\n<li>Login to your Hexnode portal and navigate to <strong>Policies-&gt; New policy-&gt; New blank policy.<\/strong><\/li>\n<li>In the macOS tab, go to <strong>Mandatory Apps<\/strong> under the <strong>App Management<\/strong> section.<\/li>\n<li>Click on <strong>Configure<\/strong> and add your respective enterprise app.<\/li>\n<li>Click on the <strong>Configure<\/strong> button next to the enterprise app name.<\/li>\n<li>In the pop-up window that appears, upload the pre-install, post-install and audit scripts according to your requirement.<\/li>\n<\/ol>\n    \t\t<div class=\"hts-messages hts-messages--alert    \"   >\r\n    \t\t\t    \t\t\t    \t\t\t\t<p>\r\n    \t\t\t\t\t<\/p>\n<h4>Binary path<\/h4>\n<p>It will depend on the shell you are using. Some common shells and their binary paths are;<\/p>\n<ul>\n<li><strong>Bash<\/strong>: \/bin\/bash<\/li>\n<li><strong>Perl<\/strong>: \/usr\/bin\/perl<\/li>\n<li><strong>Shell<\/strong>: \/bin\/sh<\/li>\n<li><strong>C Shell<\/strong>: \/bin\/csh<\/li>\n<li><strong>Zsh<\/strong>: \/bin\/zsh<\/li>\n<li><strong>Korn Shell<\/strong>: \/bin\/ksh<\/li>\n<li><strong>Python<\/strong>: \/usr\/bin\/python<\/li>\n<li><strong>Hypertext Preprocessor<\/strong>: \/usr\/bin\/php<\/li>\n<li><strong>Ruby<\/strong>: \/usr\/bin\/ruby<\/li>\n<\/ul>\n<h4>Argument<\/h4>\n<p>An argument is a value we may pass to our script when it executes. Arguments let a user dynamically change the actions a script takes or the results it produces. You may use any number of arguments for executing the scripts by separating each with a space.<\/p>\n<p>    \t\t\t\t<\/p>\r\n    \t\t\t    \t\t\t\r\n    \t\t<\/div><!-- \/.ht-shortcodes-messages -->\r\n    \t\t\n<p>Once you upload the files and enter the necessary details, click <strong>Save<\/strong> and add the policy to your target devices. This action will initiate the execution of the pre-install script, followed by app installation. You can check the installation status from the <strong>Action history<\/strong> of your device under the <strong>Manage<\/strong> section.<\/p>\n<h2>Implementation<\/h2>\n<p>The implementation of the app install happens in 4 stages after configuring all the scripts and arguments from the portal. One stage starts after the completion of the ongoing stage. If any stages fail, the action stops and acknowledges the server with error codes and output, if available.<br \/>\nLet&#8217;s see the steps involved in this process:<\/p>\n<ol>\n<li>Execute the pre-install script. Once the execution is a success, it triggers the app installation.<\/li>\n<li>Actual installation of the app happens in this stage.<\/li>\n<li>Once the installation is completed, the post-install script is executed.<\/li>\n<li>Audit script runs to check if all stages are completed and acknowledges the server.<\/li>\n<\/ol>\n<section id='resource-single'>\n                    <div class='resource-box'>\n                        <div class='resource-box__image-section'>\n                            <div class='resource-box__image-wrap'>\n                                <img decoding=\"async\" src=\"https:\/\/cdn.hexnode.com\/blogs\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-11-28-at-4.26.45-PM.png?format=webp\" class=\"resource-box__image\" alt=\"pre post app install scripts\" loading=\"lazy\" srcset=\"https:\/\/cdn.hexnode.com\/blogs\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-11-28-at-4.26.45-PM.png?format=webp 1082w, https:\/\/cdn.hexnode.com\/blogs\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-11-28-at-4.26.45-PM-233x300.png?format=webp 233w, https:\/\/cdn.hexnode.com\/blogs\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-11-28-at-4.26.45-PM-795x1024.png?format=webp 795w, https:\/\/cdn.hexnode.com\/blogs\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-11-28-at-4.26.45-PM-768x989.png?format=webp 768w, https:\/\/cdn.hexnode.com\/blogs\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-11-28-at-4.26.45-PM-78x100.png?format=webp 78w\" sizes=\"auto, (max-width: 1082px) 100vw, 1082px\" title=\"pre post app install scripts\" \/>\n                            <\/div>\n                        <\/div>\n                        <div class='resource-box__content-section'>\n                            <h5 class='resource-box__content-subheading'>\n                            Featured resource\n                            <\/h5>\n                            <h4 class='resource-box__content-heading'>\n                            Hexnode Mac management solution\n                            <\/h4>\n                            <p class='resource-box__contents'>\n                            Get started with Hexnode\u2019s Mac Management solution to save your time and the associated IT operational costs of managing your Mac devices.\n                            <\/p>\n                            <a class='resource-box__content-link hn-cta__blogs--resource-box' href='https:\/\/www.hexnode.com\/resources\/datasheets\/hexnode-mac-management\/?utm_source=hexnode_blog_pre_post_app_install_scripts&utm_medium=referral&utm_campaign=resource_box'>\n                            DOWNLOAD DATASHEET\n                            <svg xmlns='http:\/\/www.w3.org\/2000\/svg' width='20' height='20' viewBox='0 0 20 20'>\n                            <g id='arrow' transform='translate(-309 -191)' opacity='0'>\n                                <rect id='base' width='20' height='20' transform='translate(309 191)' fill='none'\/>\n                                <path id='arrow-2' data-name='arrow' d='M13.093.5,6.8,6.8.5.5' transform='translate(315 207.594) rotate(-90)' fill='none' stroke='#0549d1' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.2'\/>\n                            <\/g>\n                            <\/svg>\n\n                            <\/a>\n                        <\/div>\n                    <\/div>\n                <\/section>\n<h2>Conclusion<\/h2>\n<p>Enterprise applications play a significant role in improving workflows and increasing employee productivity across almost all organizations. However, it\u2019s crucial to ensure that you cover all app requirement checkboxes to ensure its proper functioning. Scripts can be a powerful weapon in your arsenal if you want to automate mundane tasks. In addition, pre\/post app install scripts further simplify the process as it is incorporated within the app installation process.<\/p>\n<p>With Hexnode, you get much more than being able to customize enterprise app installation. Hexnode lets you have greater control over your enterprise applications through policies such as blacklisting, whitelisting and having customized app catalogs. It also offers a wide range of <a href=\"https:\/\/www.hexnode.com\/uem\/platform\/macos-device-management\/?utm_source=hexnode_blog_pre_post_app_install_scripts&amp;utm_medium=referral&amp;utm_campaign=internal_link\" target=\"_blank\" rel=\"noopener\">device management features<\/a> that gives you complete control over your organization&#8217;s fleet of devices. Rather than me explaining all of this, it&#8217;s better that you realize it yourself. So go ahead and sign up for the free trial to experience Hexnode\u2019s capabilities.<br \/>\n<div class=\"signup_box\"><div class=\"signup_wrap_img\"><div class=\"signup-bg\" style=\"background-image:url(https:\/\/cdn.hexnode.com\/blogs\/wp-content\/uploads\/2021\/11\/zero-touch-for-macs.png?format=webp)\"><\/div><\/div><div class=\"signup_wrap\"><h5>Start your free trial today!<\/h5><p>Start your 14-day free trial to get a first hand experience on Hexnode's Mac management capabilities.<\/p><a href=\"https:\/\/www.hexnode.com\/uem\/platform\/macos-device-management\/?utm_source=hexnode_blog_pre_post_app_install_scripts&utm_medium=referral&utm_campaign=trial_sign_up_box\" class=\"hn-cta__blogs--signup-stripe\" target=\"_blank\"> SIGN UP NOW<\/a><\/div><\/div><br \/>\n<strong>Disclaimer<\/strong><\/p>\n<p>The Sample Scripts provided here are adapted from third-party Open-Source sites. We recommend you to manually validate the script execution on a system before executing the action in bulk.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u201cAn error occurred while installing the application.\u201d \u201cThe application can\u2019t be opened.\u201d These words are&#8230;<\/p>\n","protected":false},"author":55,"featured_media":23429,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2020,263],"tags":[4835,855],"class_list":["post-23287","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-beginners-guide","category-technical-deep-dives","tag-scripting","tag-mac-management","tab_group-how-tos"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Using pre\/post app install scripts<\/title>\n<meta name=\"description\" content=\"Adding pre or post app install scripts ensures proper installation of your enterprise apps as it further customizes the installation process.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hexnode.com\/blogs\/using-pre-post-app-installation-scripts\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using pre\/post app install scripts\" \/>\n<meta property=\"og:description\" content=\"Adding pre or post app install scripts ensures proper installation of your enterprise apps as it further customizes the installation process.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hexnode.com\/blogs\/using-pre-post-app-installation-scripts\/\" \/>\n<meta property=\"og:site_name\" content=\"Hexnode Blogs\" \/>\n<meta property=\"article:published_time\" content=\"2023-05-08T04:22:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-05-08T05:03:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.hexnode.com\/blogs\/wp-content\/uploads\/2022\/11\/using-pre-post-app-install-scripts.jpeg?format=webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"688\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Aiden Ramirez\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Aiden Ramirez\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.hexnode.com\/blogs\/using-pre-post-app-installation-scripts\/\",\"url\":\"https:\/\/www.hexnode.com\/blogs\/using-pre-post-app-installation-scripts\/\",\"name\":\"Using pre\/post app install scripts\",\"isPartOf\":{\"@id\":\"https:\/\/www.hexnode.com\/blogs\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.hexnode.com\/blogs\/using-pre-post-app-installation-scripts\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.hexnode.com\/blogs\/using-pre-post-app-installation-scripts\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdn.hexnode.com\/blogs\/wp-content\/uploads\/2022\/11\/using-pre-post-app-install-scripts.jpeg?format=webp\",\"datePublished\":\"2023-05-08T04:22:01+00:00\",\"dateModified\":\"2023-05-08T05:03:16+00:00\",\"author\":{\"@id\":\"https:\/\/www.hexnode.com\/blogs\/#\/schema\/person\/4c247c27aae6a1ec20892d1f6e77a2ff\"},\"description\":\"Adding pre or post app install scripts ensures proper installation of your enterprise apps as it further customizes the installation process.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.hexnode.com\/blogs\/using-pre-post-app-installation-scripts\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.hexnode.com\/blogs\/using-pre-post-app-installation-scripts\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.hexnode.com\/blogs\/using-pre-post-app-installation-scripts\/#primaryimage\",\"url\":\"https:\/\/cdn.hexnode.com\/blogs\/wp-content\/uploads\/2022\/11\/using-pre-post-app-install-scripts.jpeg?format=webp\",\"contentUrl\":\"https:\/\/cdn.hexnode.com\/blogs\/wp-content\/uploads\/2022\/11\/using-pre-post-app-install-scripts.jpeg?format=webp\",\"width\":1280,\"height\":688,\"caption\":\"using pre post app install scripts\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.hexnode.com\/blogs\/using-pre-post-app-installation-scripts\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.hexnode.com\/blogs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using pre\/post app installation scripts\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.hexnode.com\/blogs\/#website\",\"url\":\"https:\/\/www.hexnode.com\/blogs\/\",\"name\":\"Hexnode Blogs\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.hexnode.com\/blogs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.hexnode.com\/blogs\/#\/schema\/person\/4c247c27aae6a1ec20892d1f6e77a2ff\",\"name\":\"Aiden Ramirez\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.hexnode.com\/blogs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/bbaf3daa41d7c24eafb089192f139af88a7618892914e87f518ef9ba94e15db8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/bbaf3daa41d7c24eafb089192f139af88a7618892914e87f518ef9ba94e15db8?s=96&d=mm&r=g\",\"caption\":\"Aiden Ramirez\"},\"description\":\"Product Evangelist @ Hexnode. Hey Ferb, I know what we're gonna do today!\",\"url\":\"https:\/\/www.hexnode.com\/blogs\/author\/midhun-v\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using pre\/post app install scripts","description":"Adding pre or post app install scripts ensures proper installation of your enterprise apps as it further customizes the installation process.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.hexnode.com\/blogs\/using-pre-post-app-installation-scripts\/","og_locale":"en_US","og_type":"article","og_title":"Using pre\/post app install scripts","og_description":"Adding pre or post app install scripts ensures proper installation of your enterprise apps as it further customizes the installation process.","og_url":"https:\/\/www.hexnode.com\/blogs\/using-pre-post-app-installation-scripts\/","og_site_name":"Hexnode Blogs","article_published_time":"2023-05-08T04:22:01+00:00","article_modified_time":"2023-05-08T05:03:16+00:00","og_image":[{"width":1280,"height":688,"url":"https:\/\/cdn.hexnode.com\/blogs\/wp-content\/uploads\/2022\/11\/using-pre-post-app-install-scripts.jpeg?format=webp","type":"image\/jpeg"}],"author":"Aiden Ramirez","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Aiden Ramirez","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.hexnode.com\/blogs\/using-pre-post-app-installation-scripts\/","url":"https:\/\/www.hexnode.com\/blogs\/using-pre-post-app-installation-scripts\/","name":"Using pre\/post app install scripts","isPartOf":{"@id":"https:\/\/www.hexnode.com\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.hexnode.com\/blogs\/using-pre-post-app-installation-scripts\/#primaryimage"},"image":{"@id":"https:\/\/www.hexnode.com\/blogs\/using-pre-post-app-installation-scripts\/#primaryimage"},"thumbnailUrl":"https:\/\/cdn.hexnode.com\/blogs\/wp-content\/uploads\/2022\/11\/using-pre-post-app-install-scripts.jpeg?format=webp","datePublished":"2023-05-08T04:22:01+00:00","dateModified":"2023-05-08T05:03:16+00:00","author":{"@id":"https:\/\/www.hexnode.com\/blogs\/#\/schema\/person\/4c247c27aae6a1ec20892d1f6e77a2ff"},"description":"Adding pre or post app install scripts ensures proper installation of your enterprise apps as it further customizes the installation process.","breadcrumb":{"@id":"https:\/\/www.hexnode.com\/blogs\/using-pre-post-app-installation-scripts\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hexnode.com\/blogs\/using-pre-post-app-installation-scripts\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hexnode.com\/blogs\/using-pre-post-app-installation-scripts\/#primaryimage","url":"https:\/\/cdn.hexnode.com\/blogs\/wp-content\/uploads\/2022\/11\/using-pre-post-app-install-scripts.jpeg?format=webp","contentUrl":"https:\/\/cdn.hexnode.com\/blogs\/wp-content\/uploads\/2022\/11\/using-pre-post-app-install-scripts.jpeg?format=webp","width":1280,"height":688,"caption":"using pre post app install scripts"},{"@type":"BreadcrumbList","@id":"https:\/\/www.hexnode.com\/blogs\/using-pre-post-app-installation-scripts\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.hexnode.com\/blogs\/"},{"@type":"ListItem","position":2,"name":"Using pre\/post app installation scripts"}]},{"@type":"WebSite","@id":"https:\/\/www.hexnode.com\/blogs\/#website","url":"https:\/\/www.hexnode.com\/blogs\/","name":"Hexnode Blogs","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hexnode.com\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.hexnode.com\/blogs\/#\/schema\/person\/4c247c27aae6a1ec20892d1f6e77a2ff","name":"Aiden Ramirez","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hexnode.com\/blogs\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/bbaf3daa41d7c24eafb089192f139af88a7618892914e87f518ef9ba94e15db8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/bbaf3daa41d7c24eafb089192f139af88a7618892914e87f518ef9ba94e15db8?s=96&d=mm&r=g","caption":"Aiden Ramirez"},"description":"Product Evangelist @ Hexnode. Hey Ferb, I know what we're gonna do today!","url":"https:\/\/www.hexnode.com\/blogs\/author\/midhun-v\/"}]}},"_links":{"self":[{"href":"https:\/\/www.hexnode.com\/blogs\/wp-json\/wp\/v2\/posts\/23287","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hexnode.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hexnode.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hexnode.com\/blogs\/wp-json\/wp\/v2\/users\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hexnode.com\/blogs\/wp-json\/wp\/v2\/comments?post=23287"}],"version-history":[{"count":27,"href":"https:\/\/www.hexnode.com\/blogs\/wp-json\/wp\/v2\/posts\/23287\/revisions"}],"predecessor-version":[{"id":24816,"href":"https:\/\/www.hexnode.com\/blogs\/wp-json\/wp\/v2\/posts\/23287\/revisions\/24816"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hexnode.com\/blogs\/wp-json\/wp\/v2\/media\/23429"}],"wp:attachment":[{"href":"https:\/\/www.hexnode.com\/blogs\/wp-json\/wp\/v2\/media?parent=23287"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hexnode.com\/blogs\/wp-json\/wp\/v2\/categories?post=23287"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hexnode.com\/blogs\/wp-json\/wp\/v2\/tags?post=23287"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}