{"id":2802,"date":"2012-01-18T20:50:46","date_gmt":"2012-01-18T19:50:46","guid":{"rendered":"http:\/\/contoso.se\/blog\/?p=2802"},"modified":"2012-01-18T20:51:19","modified_gmt":"2012-01-18T19:51:19","slug":"building-a-sleep-activity-for-orchestrator","status":"publish","type":"post","link":"http:\/\/contoso.se\/blog\/?p=2802","title":{"rendered":"Building a SLEEP activity for Orchestrator"},"content":{"rendered":"<p>When building runbooks you sometimes need to include a delay or a sleep. You can configure a delay on the links between activities, but it is not always a good solution. In the example in the image below I have a delay on each link. As you can see it looks like the runbook is on the first activity, but it is not, it is on the link, waiting. You don&#8217;t see the link as a step in the runbook and you cant see the link delay as a step in the history log either. A better alternative is to use a &#8220;wait&#8221; or &#8220;sleep&#8221; activity. In this blog post I will show you how you can build a &#8220;sleep&#8221; activity with Orchestrator Integration Toolkit. We will use a Powershell cmdlet named start-sleep and input number of seconds we want to sleep.<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/01\/20120118-wait-01.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-2803\" style=\"border: 1px solid black;\" title=\"20120118-wait-01\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/01\/20120118-wait-01-300x186.jpg\" alt=\"\" width=\"300\" height=\"186\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/01\/20120118-wait-01-300x186.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/01\/20120118-wait-01.jpg 770w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<ol>\n<li>Download and install the Orchestrator Integration Toolkit<\/li>\n<li>Start the Orchestrator Command-Line Activity Wizard<\/li>\n<li>On the welcome page click Next<\/li>\n<li>Assembly Details. Input a\u00c2\u00a0name a assembly file, for example ContosoSleep as name and C:\\IP\\ContosoSleep.dll as\u00c2\u00a0assembly file<\/li>\n<li>Commands. Click Add<\/li>\n<li>Add\/Edit Command. Input<br \/>\nName:\u00c2\u00a0Sleep<br \/>\nMode: Run Windows PowerShell<\/li>\n<li>Switch to the Arguments tab, click Add parameter<\/li>\n<li>Add\/Edit Parameter. Input<br \/>\nName: Number of seconds to sleep<br \/>\nUsage mode: Command Argument<br \/>\nDisplay Style: Text<br \/>\nDefault value:\u00c2\u00a0&lt;leave blank&gt;<\/li>\n<li>Click Ok<\/li>\n<li>On the Arguments tab, in the Command Line text field, input<br \/>\nstart-sleep -s<br \/>\nthen click Insert and Number of seconds to sleep<br \/>\n<a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/01\/20120118-wait-02.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-2806\" title=\"20120118-wait-02\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/01\/20120118-wait-02-300x230.jpg\" alt=\"\" width=\"300\" height=\"230\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/01\/20120118-wait-02-300x230.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/01\/20120118-wait-02.jpg 466w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/li>\n<li>Click Ok<\/li>\n<li>Commands. Click Next<\/li>\n<li>When you see &#8220;The wizard completed successfully&#8221; click &#8220;Build Integration Pack&#8221;<\/li>\n<li>Product Details. Fill in the information, for example<br \/>\nProduct Name: Contoso Sleep<br \/>\nCategory Name: Sleep<br \/>\nCompany: Contoso<br \/>\nYou can click Modify and change the icon. Click Next<\/li>\n<li>Activities. Verify that your Sleep activity is listed, then click Next<\/li>\n<li>Dependencies and included files. Our example don&#8217;t need any extra files so click Next<\/li>\n<li>Orchestrator Integration Pack File. Input a path where the Integration Pack will be created. Click Next<\/li>\n<li>The integration pack is created. Click Finish to exit the wizard<\/li>\n<\/ol>\n<p>Now,\u00c2\u00a0register and deploy\u00c2\u00a0the integration pack with Deployment Manager. After that is successfully you can restart your Runbook Designer console and you will see a new Integration Pack with your new activity.<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/01\/20120118-wait-03.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-2808\" title=\"20120118-wait-03\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/01\/20120118-wait-03-300x205.jpg\" alt=\"\" width=\"300\" height=\"205\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/01\/20120118-wait-03-300x205.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/01\/20120118-wait-03.jpg 679w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>As you can see in the image below we can now easy see that the runbook is in &#8220;sleep mode&#8221; as Sleep is its own activity. More examples with the Orchestrator Integration Toolkit can be found <a title=\"How-to build custom activities with QIK and PowerShell\" href=\"http:\/\/contoso.se\/blog\/?p=2449\">here<\/a>. You can download my sleep IP here. <a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/01\/ContosoSleep.zip\">ContosoSleep<\/a>\u00c2\u00a0. Please note that this is provided \u00e2\u20ac\u0153as is\u00e2\u20ac\u009d with no warranties at all.<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/01\/20120118-wait-04.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-2809\" title=\"20120118-wait-04\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/01\/20120118-wait-04-300x291.jpg\" alt=\"\" width=\"300\" height=\"291\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/01\/20120118-wait-04-300x291.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/01\/20120118-wait-04.jpg 527w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When building runbooks you sometimes need to include a delay or a sleep. You can configure a delay on the links between activities, but it is not always a good solution. In the example in the image below I have a delay on each link. As you can see it looks like the runbook is &hellip; <a href=\"http:\/\/contoso.se\/blog\/?p=2802\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[60],"tags":[],"_links":{"self":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2802"}],"collection":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2802"}],"version-history":[{"count":8,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2802\/revisions"}],"predecessor-version":[{"id":2815,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2802\/revisions\/2815"}],"wp:attachment":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2802"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2802"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2802"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}