{"id":3848,"date":"2014-01-05T20:57:18","date_gmt":"2014-01-05T19:57:18","guid":{"rendered":"http:\/\/contoso.se\/blog\/?p=3848"},"modified":"2014-01-05T20:57:48","modified_gmt":"2014-01-05T19:57:48","slug":"export-runbooks-with-sma","status":"publish","type":"post","link":"http:\/\/contoso.se\/blog\/?p=3848","title":{"rendered":"Export runbooks with SMA"},"content":{"rendered":"<p>This runbook can be used to export SMA runbooks based on runbook tag. All runbooks with the tag you specify as a parameter will be exported to the C:\\TEMP folder. Remember to update $WebServiceEndPoint to your SMA web service.<\/p>\n<p><code><br \/>\nworkflow Export-Runbook<br \/>\n{<br \/>\nparam<br \/>\n(<br \/>\n[Parameter(Mandatory=$true)]<br \/>\n[string] $Tag<br \/>\n)<br \/>\n$WebServiceEndpoint = \"https:\/\/wap01\"<br \/>\nInLineScript {<br \/>\n$runbooks = Get-SMArunbook -WebServiceEndpoint $using:WebServiceEndpoint | Where-Object {$_.Tags -like \"*$using:Tag*\"}<br \/>\nforeach ($i in $runbooks)<br \/>\n{<br \/>\n$runbooktoexport = Get-SmaRunbookDefinition -Type Draft -WebServiceEndpoint $using:WebServiceEndpoint -name $i.RunbookName<br \/>\n$outpath = \"C:\\temp\\\" + $i.RunbookName + \".txt\"<br \/>\n$runbooktoexport.Content | Out-File $outpath<br \/>\n}<br \/>\n}<br \/>\n}<br \/>\n<\/code><\/p>\n<p>Note that this is provided \u00e2\u20ac\u0153AS-IS\u00e2\u20ac\u009d with no warranties at all. This is not a production ready solution, just an idea and an example.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This runbook can be used to export SMA runbooks based on runbook tag. All runbooks with the tag you specify as a parameter will be exported to the C:\\TEMP folder. Remember to update $WebServiceEndPoint to your SMA web service. workflow Export-Runbook { param ( [Parameter(Mandatory=$true)] [string] $Tag ) $WebServiceEndpoint = &#8220;https:\/\/wap01&#8221; InLineScript { $runbooks = &hellip; <a href=\"http:\/\/contoso.se\/blog\/?p=3848\">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":[62],"tags":[],"_links":{"self":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3848"}],"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=3848"}],"version-history":[{"count":4,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3848\/revisions"}],"predecessor-version":[{"id":3852,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3848\/revisions\/3852"}],"wp:attachment":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3848"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3848"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}