{"id":14555,"date":"2018-02-27T06:00:18","date_gmt":"2018-02-27T14:00:18","guid":{"rendered":"https:\/\/www.sapien.com\/blog\/?p=14555"},"modified":"2018-07-09T09:01:19","modified_gmt":"2018-07-09T16:01:19","slug":"new-powershell-service-template-for-primalscript-2018","status":"publish","type":"post","link":"https:\/\/dev.sapien.com\/blog\/2018\/02\/27\/new-powershell-service-template-for-primalscript-2018\/","title":{"rendered":"New PowerShell Service Template for PrimalScript 2018"},"content":{"rendered":"<p>PrimalScript 2018 supports advanced functionality for Windows services written in PowerShell and packaged with PrimalScript 2018 or PowerShell Studio 2018. While your old code will still work unmodified with this packager engine as it detects the presence of the new functions, it is a good idea to revamp your code to use the new template.<\/p>\n<p>You can find the new template under <strong><em>File<\/em><\/strong>, <em><strong>New<\/strong><\/em>, <strong><em>PowerShell Service<\/em><\/strong> as shown below:<\/p>\n<p><a href=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2018\/02\/image-6.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px; border: 0px currentcolor; display: inline; background-image: none;\" title=\"image\" src=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2018\/02\/image_thumb-6.png\" alt=\"image\" width=\"640\" height=\"353\" border=\"0\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>The new template features three preset functions:<\/p>\n<table class=\"nicetable\" style=\"height: 341px;\" border=\"0\" width=\"867\" cellspacing=\"0\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"258\"><strong>Start-MyService<\/strong><\/td>\n<td valign=\"top\" width=\"258\">This function is called when your service starts. You should place all initialization code for your service here.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"258\"><strong>Invoke-Myservice<\/strong><\/td>\n<td valign=\"top\" width=\"258\">This is your service\u2019s main loop. Take a minute to look at the template to understand the process \u2013 sleep \u2013 process cycle as your service executes.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"258\"><strong>Stop-MyService<\/strong><\/td>\n<td valign=\"top\" width=\"258\">This function is called when your service is asked to stop by the operating system or when using Stop-Service. You can see some management code in here that will allow your main service loop to exit gracefully. Place code to close connections and release resources here.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>Please <strong>do<\/strong> <strong>not<\/strong> rename these functions. You can add your own functions as you see fit, but these three functions and their names are essential to make your service execute properly once packaged.<\/p>\n<p><a href=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2018\/02\/image-7.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px; border: 0px currentcolor; display: inline; background-image: none;\" title=\"image\" src=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2018\/02\/image_thumb-7.png\" alt=\"image\" width=\"591\" height=\"480\" border=\"0\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Please note that the main service thread is forcefully terminated after you exit the <strong>Stop-MyService<\/strong> function. Make sure you terminate running jobs and secondary runspaces here; otherwise the service process may hang and not exit properly.<br \/>\nAs some modules create their own threads, jobs, runspaces, etc. it is also a good idea to use remove-module for any modules you load implicitly or explicitly. The script itself does not operate as a service, but you could dot source it from a test script to execute the functions for testing.<\/p>\n<p>Ultimately, to make a real Windows service, you need to package your script with a PowerShell Windows Service engine as shown here:<\/p>\n<p><a href=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2018\/02\/image-8.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" style=\"border: 0px currentcolor; display: inline; background-image: none;\" title=\"image\" src=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2018\/02\/image_thumb-8.png\" alt=\"image\" width=\"640\" height=\"353\" border=\"0\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>As illustrated in a <a href=\"https:\/\/www.sapien.com\/blog\/2017\/07\/12\/write-a-windows-service-in-powershell\/\">previous blog article<\/a>, the <strong>&lt;service&gt;.exe \/i<\/strong> and <strong>&lt;service&gt;.exe \/u<\/strong> command line parameters can be used to self-install \/ uninstall the service on your machine.<\/p>\n<p><a href=\"https:\/\/www.sapien.com\/blog\/2018\/07\/09\/pause-and-continue-added-to-powershell-service-packager-engine\/\">View this article<\/a> for information on using the\u00a0<em>Pause<\/em> and\u00a0<em>Continue<\/em> events.<\/p>\n<h3>Feedback<\/h3>\n<p>If you have any questions, concerns or feedback you are, as always, more than welcome to <a href=\"https:\/\/www.sapien.com\/forums\/index.php\">visit our support forum<\/a>\u00a0and post a message in the appropriate section.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PrimalScript 2018 supports advanced functionality for Windows services written in PowerShell and packaged with PrimalScript 2018 or PowerShell Studio 2018. While your old code will still work unmodified with this packager engine as it detects the presence of the new functions, it is a good idea to revamp your code to use the new template. [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[703,410,1055,21,25],"tags":[437,28,1016,37,300,1032,997],"class_list":["post-14555","post","type-post","status-publish","format-standard","hentry","category-powershell-studio","category-primalscript-software-news","category-scripting","category-software-news","category-windows-powershell","tag-packager","tag-powershell","tag-powershell-studio","tag-primalscript","tag-service","tag-template","tag-windows-powershell"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"PrimalScript 2018 supports advanced functionality for Windows services written in PowerShell and packaged with PrimalScript 2018 or PowerShell Studio 2018. While your old code will still work unmodified with this packager engine as it detects the presence of the new functions, it is a good idea to revamp your code to use the new template.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Alex Riedel\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/dev.sapien.com\/blog\/2018\/02\/27\/new-powershell-service-template-for-primalscript-2018\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"DEV SAPIEN Blog - Tools for IT Success\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"New PowerShell Service Template for PrimalScript 2018 - DEV SAPIEN Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"PrimalScript 2018 supports advanced functionality for Windows services written in PowerShell and packaged with PrimalScript 2018 or PowerShell Studio 2018. While your old code will still work unmodified with this packager engine as it detects the presence of the new functions, it is a good idea to revamp your code to use the new template.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/dev.sapien.com\/blog\/2018\/02\/27\/new-powershell-service-template-for-primalscript-2018\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2018-02-27T14:00:18+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2018-07-09T16:01:19+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"New PowerShell Service Template for PrimalScript 2018 - DEV SAPIEN Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"PrimalScript 2018 supports advanced functionality for Windows services written in PowerShell and packaged with PrimalScript 2018 or PowerShell Studio 2018. While your old code will still work unmodified with this packager engine as it detects the presence of the new functions, it is a good idea to revamp your code to use the new template.\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2018\\\/02\\\/27\\\/new-powershell-service-template-for-primalscript-2018\\\/#blogposting\",\"name\":\"New PowerShell Service Template for PrimalScript 2018 - DEV SAPIEN Blog\",\"headline\":\"New PowerShell Service Template for PrimalScript 2018\",\"author\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/alexander-riedel\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.sapien.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/02\\\/image_thumb-6.png\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2018\\\/02\\\/27\\\/new-powershell-service-template-for-primalscript-2018\\\/#articleImage\"},\"datePublished\":\"2018-02-27T06:00:18-08:00\",\"dateModified\":\"2018-07-09T09:01:19-07:00\",\"inLanguage\":\"en-US\",\"commentCount\":1,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2018\\\/02\\\/27\\\/new-powershell-service-template-for-primalscript-2018\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2018\\\/02\\\/27\\\/new-powershell-service-template-for-primalscript-2018\\\/#webpage\"},\"articleSection\":\"PowerShell Studio, PrimalScript, Scripting, Software News, Windows PowerShell, Packager, powershell, PowerShell Studio, PrimalScript, Service, template, Windows PowerShell\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2018\\\/02\\\/27\\\/new-powershell-service-template-for-primalscript-2018\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/dev.sapien.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/software-news\\\/#listItem\",\"name\":\"Software News\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/software-news\\\/#listItem\",\"position\":2,\"name\":\"Software News\",\"item\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/software-news\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/software-news\\\/primalscript-software-news\\\/#listItem\",\"name\":\"PrimalScript\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/software-news\\\/primalscript-software-news\\\/#listItem\",\"position\":3,\"name\":\"PrimalScript\",\"item\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/software-news\\\/primalscript-software-news\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2018\\\/02\\\/27\\\/new-powershell-service-template-for-primalscript-2018\\\/#listItem\",\"name\":\"New PowerShell Service Template for PrimalScript 2018\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/software-news\\\/#listItem\",\"name\":\"Software News\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2018\\\/02\\\/27\\\/new-powershell-service-template-for-primalscript-2018\\\/#listItem\",\"position\":4,\"name\":\"New PowerShell Service Template for PrimalScript 2018\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/software-news\\\/primalscript-software-news\\\/#listItem\",\"name\":\"PrimalScript\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#organization\",\"name\":\"DEV SAPIEN Blog\",\"description\":\"Tools for IT Success\",\"url\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/alexander-riedel\\\/#author\",\"url\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/alexander-riedel\\\/\",\"name\":\"Alex Riedel\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2018\\\/02\\\/27\\\/new-powershell-service-template-for-primalscript-2018\\\/#webpage\",\"url\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2018\\\/02\\\/27\\\/new-powershell-service-template-for-primalscript-2018\\\/\",\"name\":\"New PowerShell Service Template for PrimalScript 2018 - DEV SAPIEN Blog\",\"description\":\"PrimalScript 2018 supports advanced functionality for Windows services written in PowerShell and packaged with PrimalScript 2018 or PowerShell Studio 2018. While your old code will still work unmodified with this packager engine as it detects the presence of the new functions, it is a good idea to revamp your code to use the new template.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2018\\\/02\\\/27\\\/new-powershell-service-template-for-primalscript-2018\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/alexander-riedel\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/alexander-riedel\\\/#author\"},\"datePublished\":\"2018-02-27T06:00:18-08:00\",\"dateModified\":\"2018-07-09T09:01:19-07:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/\",\"name\":\"DEV SAPIEN Blog\",\"description\":\"Tools for IT Success\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"New PowerShell Service Template for PrimalScript 2018 - DEV SAPIEN Blog","description":"PrimalScript 2018 supports advanced functionality for Windows services written in PowerShell and packaged with PrimalScript 2018 or PowerShell Studio 2018. While your old code will still work unmodified with this packager engine as it detects the presence of the new functions, it is a good idea to revamp your code to use the new template.","canonical_url":"https:\/\/dev.sapien.com\/blog\/2018\/02\/27\/new-powershell-service-template-for-primalscript-2018\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/dev.sapien.com\/blog\/2018\/02\/27\/new-powershell-service-template-for-primalscript-2018\/#blogposting","name":"New PowerShell Service Template for PrimalScript 2018 - DEV SAPIEN Blog","headline":"New PowerShell Service Template for PrimalScript 2018","author":{"@id":"https:\/\/dev.sapien.com\/blog\/author\/alexander-riedel\/#author"},"publisher":{"@id":"https:\/\/dev.sapien.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2018\/02\/image_thumb-6.png","@id":"https:\/\/dev.sapien.com\/blog\/2018\/02\/27\/new-powershell-service-template-for-primalscript-2018\/#articleImage"},"datePublished":"2018-02-27T06:00:18-08:00","dateModified":"2018-07-09T09:01:19-07:00","inLanguage":"en-US","commentCount":1,"mainEntityOfPage":{"@id":"https:\/\/dev.sapien.com\/blog\/2018\/02\/27\/new-powershell-service-template-for-primalscript-2018\/#webpage"},"isPartOf":{"@id":"https:\/\/dev.sapien.com\/blog\/2018\/02\/27\/new-powershell-service-template-for-primalscript-2018\/#webpage"},"articleSection":"PowerShell Studio, PrimalScript, Scripting, Software News, Windows PowerShell, Packager, powershell, PowerShell Studio, PrimalScript, Service, template, Windows PowerShell"},{"@type":"BreadcrumbList","@id":"https:\/\/dev.sapien.com\/blog\/2018\/02\/27\/new-powershell-service-template-for-primalscript-2018\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/dev.sapien.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/topics\/software-news\/#listItem","name":"Software News"}},{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/topics\/software-news\/#listItem","position":2,"name":"Software News","item":"https:\/\/dev.sapien.com\/blog\/topics\/software-news\/","nextItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/topics\/software-news\/primalscript-software-news\/#listItem","name":"PrimalScript"},"previousItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/topics\/software-news\/primalscript-software-news\/#listItem","position":3,"name":"PrimalScript","item":"https:\/\/dev.sapien.com\/blog\/topics\/software-news\/primalscript-software-news\/","nextItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/2018\/02\/27\/new-powershell-service-template-for-primalscript-2018\/#listItem","name":"New PowerShell Service Template for PrimalScript 2018"},"previousItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/topics\/software-news\/#listItem","name":"Software News"}},{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/2018\/02\/27\/new-powershell-service-template-for-primalscript-2018\/#listItem","position":4,"name":"New PowerShell Service Template for PrimalScript 2018","previousItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/topics\/software-news\/primalscript-software-news\/#listItem","name":"PrimalScript"}}]},{"@type":"Organization","@id":"https:\/\/dev.sapien.com\/blog\/#organization","name":"DEV SAPIEN Blog","description":"Tools for IT Success","url":"https:\/\/dev.sapien.com\/blog\/"},{"@type":"Person","@id":"https:\/\/dev.sapien.com\/blog\/author\/alexander-riedel\/#author","url":"https:\/\/dev.sapien.com\/blog\/author\/alexander-riedel\/","name":"Alex Riedel"},{"@type":"WebPage","@id":"https:\/\/dev.sapien.com\/blog\/2018\/02\/27\/new-powershell-service-template-for-primalscript-2018\/#webpage","url":"https:\/\/dev.sapien.com\/blog\/2018\/02\/27\/new-powershell-service-template-for-primalscript-2018\/","name":"New PowerShell Service Template for PrimalScript 2018 - DEV SAPIEN Blog","description":"PrimalScript 2018 supports advanced functionality for Windows services written in PowerShell and packaged with PrimalScript 2018 or PowerShell Studio 2018. While your old code will still work unmodified with this packager engine as it detects the presence of the new functions, it is a good idea to revamp your code to use the new template.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/dev.sapien.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/dev.sapien.com\/blog\/2018\/02\/27\/new-powershell-service-template-for-primalscript-2018\/#breadcrumblist"},"author":{"@id":"https:\/\/dev.sapien.com\/blog\/author\/alexander-riedel\/#author"},"creator":{"@id":"https:\/\/dev.sapien.com\/blog\/author\/alexander-riedel\/#author"},"datePublished":"2018-02-27T06:00:18-08:00","dateModified":"2018-07-09T09:01:19-07:00"},{"@type":"WebSite","@id":"https:\/\/dev.sapien.com\/blog\/#website","url":"https:\/\/dev.sapien.com\/blog\/","name":"DEV SAPIEN Blog","description":"Tools for IT Success","inLanguage":"en-US","publisher":{"@id":"https:\/\/dev.sapien.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"DEV SAPIEN Blog - Tools for IT Success","og:type":"article","og:title":"New PowerShell Service Template for PrimalScript 2018 - DEV SAPIEN Blog","og:description":"PrimalScript 2018 supports advanced functionality for Windows services written in PowerShell and packaged with PrimalScript 2018 or PowerShell Studio 2018. While your old code will still work unmodified with this packager engine as it detects the presence of the new functions, it is a good idea to revamp your code to use the new template.","og:url":"https:\/\/dev.sapien.com\/blog\/2018\/02\/27\/new-powershell-service-template-for-primalscript-2018\/","article:published_time":"2018-02-27T14:00:18+00:00","article:modified_time":"2018-07-09T16:01:19+00:00","twitter:card":"summary_large_image","twitter:title":"New PowerShell Service Template for PrimalScript 2018 - DEV SAPIEN Blog","twitter:description":"PrimalScript 2018 supports advanced functionality for Windows services written in PowerShell and packaged with PrimalScript 2018 or PowerShell Studio 2018. While your old code will still work unmodified with this packager engine as it detects the presence of the new functions, it is a good idea to revamp your code to use the new template."},"aioseo_meta_data":{"post_id":"14555","title":null,"description":null,"keywords":null,"keyphrases":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_custom_url":null,"og_image_custom_fields":null,"og_image_url":null,"og_image_width":null,"og_image_height":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_image_url":null,"twitter_title":null,"twitter_description":null,"schema_type":"default","schema_type_options":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null,"created":"2026-08-28 15:16:15","updated":"2026-08-28 15:16:15"},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/dev.sapien.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/dev.sapien.com\/blog\/topics\/software-news\/\" title=\"Software News\">Software News<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/dev.sapien.com\/blog\/topics\/software-news\/primalscript-software-news\/\" title=\"PrimalScript\">PrimalScript<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tNew PowerShell Service Template for PrimalScript 2018\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/dev.sapien.com\/blog"},{"label":"Software News","link":"https:\/\/dev.sapien.com\/blog\/topics\/software-news\/"},{"label":"PrimalScript","link":"https:\/\/dev.sapien.com\/blog\/topics\/software-news\/primalscript-software-news\/"},{"label":"New PowerShell Service Template for PrimalScript 2018","link":"https:\/\/dev.sapien.com\/blog\/2018\/02\/27\/new-powershell-service-template-for-primalscript-2018\/"}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/14555","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/comments?post=14555"}],"version-history":[{"count":8,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/14555\/revisions"}],"predecessor-version":[{"id":15358,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/14555\/revisions\/15358"}],"wp:attachment":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/media?parent=14555"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/categories?post=14555"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/tags?post=14555"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}