{"id":5416,"date":"2012-10-22T12:57:00","date_gmt":"2012-10-22T20:57:00","guid":{"rendered":"http:\/\/www.sapien.com\/blog\/?p=5416"},"modified":"2012-10-22T12:59:58","modified_gmt":"2012-10-22T20:59:58","slug":"debugging-modules-in-powershell-studio-2012","status":"publish","type":"post","link":"https:\/\/dev.sapien.com\/blog\/2012\/10\/22\/debugging-modules-in-powershell-studio-2012\/","title":{"rendered":"Debugging Modules in PowerShell Studio 2012"},"content":{"rendered":"<p>PowerShell Studio now makes it easier to debug and run your module projects. You now have the ability to execute and debug a module project directly from the IDE (Supported in PowerShell Studio 2012 v3.1.9 and up).<\/p>\n<p><strong>Debugging a module project:<\/strong><\/p>\n<p>When debugging (F4) or running (Ctrl + F4) a module project for the first time you will be asked to select a Startup Script:<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/10\/Select-Startup-Script.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;\" title=\"Select Startup Script\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/10\/Select-Startup-Script_thumb.png\" alt=\"Select Startup Script\" width=\"244\" height=\"172\" border=\"0\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>This Startup Script will be used by PowerShell Studio as an entry point to run or debug the module project. Therefore, it\u2019s important that you explicitly import the module in the script:<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/10\/Startup-Script.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;\" title=\"Startup Script\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/10\/Startup-Script_thumb.png\" alt=\"Startup Script\" width=\"244\" height=\"173\" border=\"0\" \/><\/a><\/p>\n<p>The Startup Script will be stored by the module project so you don\u2019t have to select the script every time you wish to test the module. In addition, you have the option to change the Startup Script in the project\u2019s properties.<\/p>\n<p>To change the Startup Script, follow these simple steps:<\/p>\n<blockquote><p>1. Select the project node in the Project Panel:<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/10\/Project-Panel.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;\" title=\"Project Panel\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/10\/Project-Panel_thumb.png\" alt=\"Project Panel\" width=\"161\" height=\"244\" border=\"0\" \/><\/a><\/p><\/blockquote>\n<blockquote><p>2. Go to the Property Panel and edit the Startup Script property:<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/10\/Property-Panel.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;\" title=\"Property Panel\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/10\/Property-Panel_thumb.png\" alt=\"Property Panel\" width=\"186\" height=\"244\" border=\"0\" \/><\/a><\/p><\/blockquote>\n<p>When debugging a module project, PowerShell Studio will build and export the module then execute the Startup Script.\u00a0 Any trace points and break points contained within the project files will be triggered by the debugger and mapped to the appropriate files:<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/10\/Breakpoints-in-Module-Project-Files.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;\" title=\"Breakpoints in Module Project Files\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/10\/Breakpoints-in-Module-Project-Files_thumb.png\" alt=\"Breakpoints in Module Project Files\" width=\"244\" height=\"185\" border=\"0\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Debugging a module without a project:<\/strong><\/p>\n<p>If you need to debug a module that doesn\u2019t have a project, you can utilize PowerShell Studio\u2019s new \u201cDebug with Multiple Files\u201d option.<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/10\/Debug-with-Multiple-Files.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;\" title=\"Debug with Multiple Files\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/10\/Debug-with-Multiple-Files_thumb.png\" alt=\"Debug with Multiple Files\" width=\"244\" height=\"185\" border=\"0\" \/><\/a><\/p>\n<p>First open the test script and the module files using PowerShell Studio. Next, debug the test script using the \u201cDebug with Multiple Files\u201d option and select the module files that you wish to debug.<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/10\/Select-Module-Files.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;\" title=\"Select Module Files\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/10\/Select-Module-Files_thumb.png\" alt=\"Select Module Files\" width=\"244\" height=\"187\" border=\"0\" \/><\/a><\/p>\n<p>Now the debugger will respond to break points located in the module files:<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/10\/Break-in-Module-File.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;\" title=\"Break in Module File\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/10\/Break-in-Module-File_thumb.png\" alt=\"Break in Module File\" width=\"244\" height=\"191\" border=\"0\" \/><\/a><\/p>\n<p>As you can see, these new features help facilitate the module creation process for any user.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PowerShell Studio now makes it easier to debug and run your module projects. You now have the ability to execute and debug a module project directly from the IDE (Supported in PowerShell Studio 2012 v3.1.9 and up). Debugging a module project: When debugging (F4) or running (Ctrl + F4) a module project for the first [&hellip;]<\/p>\n","protected":false},"author":10,"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,"footnotes":""},"categories":[705,25],"tags":[694,222,551,28,1016],"class_list":["post-5416","post","type-post","status-publish","format-standard","hentry","category-powershell-studio-2012","category-windows-powershell","tag-694","tag-debugging","tag-modules","tag-powershell","tag-powershell-studio"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/5416","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\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/comments?post=5416"}],"version-history":[{"count":6,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/5416\/revisions"}],"predecessor-version":[{"id":5460,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/5416\/revisions\/5460"}],"wp:attachment":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/media?parent=5416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/categories?post=5416"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/tags?post=5416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}