{"id":11711,"date":"2024-06-09T18:45:13","date_gmt":"2024-06-09T08:45:13","guid":{"rendered":"https:\/\/nsrd.info\/blog\/?p=11711"},"modified":"2024-06-09T18:45:15","modified_gmt":"2024-06-09T08:45:15","slug":"using-scripts-with-policies","status":"publish","type":"post","link":"https:\/\/nsrd.info\/blog\/2024\/06\/09\/using-scripts-with-policies\/","title":{"rendered":"Using Scripts with Policies"},"content":{"rendered":"\n<p>Newly added in PowerProtect Data Manager 19.16 is the ability to add pre- and post-scripts to a number of different policy types. <\/p>\n\n\n\n<p>One aspect I really like about the nature of Data Manager pre- and post-scripts is that they&#8217;re maintained on the Data Manager server, putting them in a centralised location for greater security and easier management.<\/p>\n\n\n\n<p>Let&#8217;s have a look at how they&#8217;re configured, using a simple example of someone wanting an email when the backup starts for each asset. <\/p>\n\n\n\n<p>To do this, you&#8217;d start by going to <strong>Protection > Scripts<\/strong> and creating a new script. You can either upload a script if you&#8217;ve previously created it, or you can add it, using the built-in editor. Here&#8217;s an example below where the script is manually created in the editor:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><a href=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/01_Create_Script.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1150\" height=\"985\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/01_Create_Script.png\" alt=\"PowerProtect Data Manager Script Editor\" class=\"wp-image-11713\" style=\"width:640px;height:auto\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/01_Create_Script.png 1150w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/01_Create_Script-300x257.png 300w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/01_Create_Script-1024x877.png 1024w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/01_Create_Script-768x658.png 768w\" sizes=\"auto, (max-width: 1150px) 100vw, 1150px\" \/><\/a><figcaption class=\"wp-element-caption\"><strong><em>Creating a basic pre-script for use with Data Manager backups<\/em><\/strong><\/figcaption><\/figure>\n\n\n\n<p>Once the script has been added, it&#8217;ll be visible in the list of scripts stored on the system:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/02_Script_Added.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1819\" height=\"599\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/02_Script_Added.png\" alt=\"PowerProtect Data Manager interface showing a single script created under Protection &gt; Scripts.\" class=\"wp-image-11714\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/02_Script_Added.png 1819w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/02_Script_Added-300x99.png 300w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/02_Script_Added-1024x337.png 1024w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/02_Script_Added-768x253.png 768w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/02_Script_Added-1536x506.png 1536w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/02_Script_Added-1600x527.png 1600w\" sizes=\"auto, (max-width: 1819px) 100vw, 1819px\" \/><\/a><figcaption class=\"wp-element-caption\"><strong><em>List of scripts stored on the Data Manager system<\/em><\/strong><\/figcaption><\/figure>\n\n\n\n<p>To get this script in a policy, go over to the Protection > Policies screen and edit the policy you need to add it to:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/03_Protection_Policies.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1819\" height=\"599\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/03_Protection_Policies.png\" alt=\"List of policies on a PowreProtect Data Manager server.\" class=\"wp-image-11715\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/03_Protection_Policies.png 1819w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/03_Protection_Policies-300x99.png 300w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/03_Protection_Policies-1024x337.png 1024w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/03_Protection_Policies-768x253.png 768w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/03_Protection_Policies-1536x506.png 1536w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/03_Protection_Policies-1600x527.png 1600w\" sizes=\"auto, (max-width: 1819px) 100vw, 1819px\" \/><\/a><figcaption class=\"wp-element-caption\"><strong><em>List of policies configured on a Data Manager server<\/em><\/strong><\/figcaption><\/figure>\n\n\n\n<p>In this case, I want to add my script to the &#8220;LinuxFSRoot&#8221; policy, used to backup the root filesystem of lab systems. Select the script and click the Edit button, then move forward to the <strong>Options > Pre\/Post Script<\/strong> tab in the wizard where you can select the script, its purpose, and other details:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/04_Script_In_Policy.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"626\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/04_Script_In_Policy-1024x626.png\" alt=\"\" class=\"wp-image-11716\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/04_Script_In_Policy-1024x626.png 1024w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/04_Script_In_Policy-300x183.png 300w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/04_Script_In_Policy-768x469.png 768w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/04_Script_In_Policy-1536x939.png 1536w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/04_Script_In_Policy-1600x978.png 1600w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/04_Script_In_Policy.png 1819w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\"><strong><em>Selecting the script to use with a Data Manager Policy<\/em><\/strong><\/figcaption><\/figure>\n\n\n\n<p>When done, click through the remainder of the policy editor, then save the updated policy. Now you can run the policy and check out the script results. In this case, shortly after the policy started, I received this email from the system:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/05_Script_Results.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1665\" height=\"1060\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/05_Script_Results.png\" alt=\"Email client showing an email was received indicating when the backup started and for what system.\" class=\"wp-image-11717\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/05_Script_Results.png 1665w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/05_Script_Results-300x191.png 300w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/05_Script_Results-1024x652.png 1024w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/05_Script_Results-768x489.png 768w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/05_Script_Results-1536x978.png 1536w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2024\/06\/05_Script_Results-1600x1019.png 1600w\" sizes=\"auto, (max-width: 1665px) 100vw, 1665px\" \/><\/a><figcaption class=\"wp-element-caption\"><strong><em>Evolution email client showing pre-script email received<\/em><\/strong><\/figcaption><\/figure>\n\n\n\n<p>And there you go &#8212; adding scripts to your protection policies in Data Manager is simple and straight-forward. Using this functionality you can extend protection to all manner of other scenarios (e.g., running system updates after protection, initiating database exports for databases like PostgreSQL and MySQL prior to filesystem backup, etc.) &#8212; in fact, the sky is really the limit now!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Newly added in PowerProtect Data Manager 19.16 is the ability to add pre- and post-scripts to a number of different&hellip;<\/p>\n","protected":false},"author":1,"featured_media":10322,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1520],"tags":[1600],"class_list":["post-11711","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powerprotect","tag-pre-script"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2021\/04\/bigStock-Time-Prediction-Future.jpg","jetpack_shortlink":"https:\/\/wp.me\/pKpIN-32T","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/11711","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/comments?post=11711"}],"version-history":[{"count":2,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/11711\/revisions"}],"predecessor-version":[{"id":11718,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/11711\/revisions\/11718"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/media\/10322"}],"wp:attachment":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/media?parent=11711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/categories?post=11711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/tags?post=11711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}