{"id":10,"date":"2018-04-25T02:10:21","date_gmt":"2018-04-25T02:10:21","guid":{"rendered":"http:\/\/nkascocom.nk\/wordpress\/index.php\/2018\/04\/25\/2018-4-24-how-to-build-a-powershell-gui-part-1\/"},"modified":"2018-04-25T02:10:21","modified_gmt":"2018-04-25T02:10:21","slug":"2018-4-24-how-to-build-a-powershell-gui-part-1","status":"publish","type":"post","link":"https:\/\/blog.nkasco.com\/wordpress\/index.php\/2018\/04\/25\/2018-4-24-how-to-build-a-powershell-gui-part-1\/","title":{"rendered":"How to build a Powershell GUI &#8211; Part 1"},"content":{"rendered":"<div class=\"sqs-html-content\">\n<p>It seems like more and more I am seeing people wanting to implement GUIs into their tools, my hope is that this example can be used as a model for a way to properly create a WinForm GUI for your shiny new utility that you just got done creating.&nbsp;<\/p>\n<p>In this multi-part series I will be going through from start to finish a replacement tool for Windows Event Viewer. Here is the agenda:<\/p>\n<ul style=\"margin-left:40px\">\n<li>Part 1 &#8211; Planning\/Overview<\/li>\n<li>Part 2 &#8211; Designing your GUI<\/li>\n<li>Part 3 &#8211; Integrating your code<\/li>\n<\/ul>\n<p>We will begin by creating a plan for execution of creating this new utility, this sets us up for success. Traditionally this would start with a requirements gathering from your requestor. Next we will design our actual form and plan out events to use to trigger our code behind the scenes.&nbsp;Finally, at the end we will leverage runspaces to bring it all together. If anyone has any feedback or success from this please feel free to <a href=\"\/contact\">reach out<\/a>, as I am always happy to hear positive impact made within the community. Let&#8217;s jump right in:<\/p>\n<p>To start, we need to ask ourselves what we are trying to achieve. In this case my primary goal is to pull event log information on a remote machine faster than the built in Windows Event Viewer and present the information in a way that is versatile depending on what the results may be. My plan is to create filter options that can be set <strong>prior <\/strong>(for performance)&nbsp;to querying any information from a remote machine as well as create a number of layout options for viewing results.&nbsp;<\/p>\n<p>My core functionality will be made up as follows:<\/p>\n<ul style=\"margin-left:40px\">\n<li>Get application\/security\/system logs (default to last 3 days)<\/li>\n<li>Save results to local location in viewable format<\/li>\n<li>Find\/search<\/li>\n<li>Create a runspace to execute code separate from GUI<\/li>\n<\/ul>\n<p>As far as layout options here are my initial view options:<\/p>\n<ul style=\"margin-left:40px\">\n<li>Traditional (Default)<\/li>\n<li>Side by side<\/li>\n<\/ul>\n<p>That&#8217;s about it for part 1,&nbsp;now that we have a plan we can move forward and create an actual design for our new utility.&nbsp;<\/p>\n<\/div>\n<div\n  class=\"sqs-block-button-container sqs-block-button-container--center\"\n  data-animation-role=\"button\"\n  data-alignment=\"center\"\n  data-button-size=\"medium\"\n  data-button-type=\"primary\"\n><br \/>\n  <a\n    href=\"https:\/\/www.nkasco.com\/blog\/2018\/4\/25\/how-to-build-a-powershell-gui-part-2\"\n    class=\"sqs-block-button-element--medium sqs-button-element--primary sqs-block-button-element\"\n    \n  ><br \/>\n    Part 2<br \/>\n  <\/a>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>It seems like more and more I am seeing people wanting to implement GUIs into their tools, my hope is that this example can be used as a model for a way to properly create a WinForm GUI for your shiny new utility that you just got done creating.&nbsp;<\/p>\n<p style=\"text-align: start;\">In this multi-part series I will be going through from start to finish a replacement tool for Windows Event Viewer\u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3,4],"class_list":["post-10","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-gui","tag-utilities"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to build a Powershell GUI - Part 1 - Nathan Kasco - Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.nkasco.com\/wordpress\/index.php\/2018\/04\/25\/2018-4-24-how-to-build-a-powershell-gui-part-1\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to build a Powershell GUI - Part 1 - Nathan Kasco - Blog\" \/>\n<meta property=\"og:description\" content=\"It seems like more and more I am seeing people wanting to implement GUIs into their tools, my hope is that this example can be used as a model for a way to properly create a WinForm GUI for your shiny new utility that you just got done creating.&nbsp;In this multi-part series I will be going through from start to finish a replacement tool for Windows Event Viewer\u2026\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.nkasco.com\/wordpress\/index.php\/2018\/04\/25\/2018-4-24-how-to-build-a-powershell-gui-part-1\/\" \/>\n<meta property=\"og:site_name\" content=\"Nathan Kasco - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-04-25T02:10:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/blog.nkasco.com\/wordpress\/wp-content\/uploads\/2024\/03\/cropped-logo-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"512\" \/>\n\t<meta property=\"og:image:height\" content=\"512\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Nate Kasco\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Bu5yGiraffe\" \/>\n<meta name=\"twitter:site\" content=\"@Bu5yGiraffe\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nate Kasco\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/blog.nkasco.com\/wordpress\/index.php\/2018\/04\/25\/2018-4-24-how-to-build-a-powershell-gui-part-1\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/blog.nkasco.com\/wordpress\/index.php\/2018\/04\/25\/2018-4-24-how-to-build-a-powershell-gui-part-1\/\"},\"author\":{\"name\":\"Nate Kasco\",\"@id\":\"https:\/\/blog.nkasco.com\/wordpress\/#\/schema\/person\/1dfd694a2ed094a43a37dc6882c65eb3\"},\"headline\":\"How to build a Powershell GUI &#8211; Part 1\",\"datePublished\":\"2018-04-25T02:10:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/blog.nkasco.com\/wordpress\/index.php\/2018\/04\/25\/2018-4-24-how-to-build-a-powershell-gui-part-1\/\"},\"wordCount\":365,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/blog.nkasco.com\/wordpress\/#\/schema\/person\/1dfd694a2ed094a43a37dc6882c65eb3\"},\"keywords\":[\"gui\",\"utilities\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/blog.nkasco.com\/wordpress\/index.php\/2018\/04\/25\/2018-4-24-how-to-build-a-powershell-gui-part-1\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.nkasco.com\/wordpress\/index.php\/2018\/04\/25\/2018-4-24-how-to-build-a-powershell-gui-part-1\/\",\"url\":\"https:\/\/blog.nkasco.com\/wordpress\/index.php\/2018\/04\/25\/2018-4-24-how-to-build-a-powershell-gui-part-1\/\",\"name\":\"How to build a Powershell GUI - Part 1 - Nathan Kasco - Blog\",\"isPartOf\":{\"@id\":\"https:\/\/blog.nkasco.com\/wordpress\/#website\"},\"datePublished\":\"2018-04-25T02:10:21+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/blog.nkasco.com\/wordpress\/index.php\/2018\/04\/25\/2018-4-24-how-to-build-a-powershell-gui-part-1\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.nkasco.com\/wordpress\/index.php\/2018\/04\/25\/2018-4-24-how-to-build-a-powershell-gui-part-1\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.nkasco.com\/wordpress\/index.php\/2018\/04\/25\/2018-4-24-how-to-build-a-powershell-gui-part-1\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/blog.nkasco.com\/wordpress\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to build a Powershell GUI &#8211; Part 1\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.nkasco.com\/wordpress\/#website\",\"url\":\"https:\/\/blog.nkasco.com\/wordpress\/\",\"name\":\"Nathan Kasco - Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/blog.nkasco.com\/wordpress\/#\/schema\/person\/1dfd694a2ed094a43a37dc6882c65eb3\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog.nkasco.com\/wordpress\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/blog.nkasco.com\/wordpress\/#\/schema\/person\/1dfd694a2ed094a43a37dc6882c65eb3\",\"name\":\"Nate Kasco\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/blog.nkasco.com\/wordpress\/wp-content\/uploads\/2024\/03\/cropped-logo.png\",\"url\":\"https:\/\/blog.nkasco.com\/wordpress\/wp-content\/uploads\/2024\/03\/cropped-logo.png\",\"contentUrl\":\"https:\/\/blog.nkasco.com\/wordpress\/wp-content\/uploads\/2024\/03\/cropped-logo.png\",\"width\":200,\"height\":200,\"caption\":\"Nate Kasco\"},\"logo\":{\"@id\":\"https:\/\/blog.nkasco.com\/wordpress\/wp-content\/uploads\/2024\/03\/cropped-logo.png\"},\"sameAs\":[\"http:\/\/nkascocom.nk\/wordpress\",\"https:\/\/x.com\/Bu5yGiraffe\"],\"url\":\"https:\/\/blog.nkasco.com\/wordpress\/index.php\/author\/nate\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to build a Powershell GUI - Part 1 - Nathan Kasco - Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.nkasco.com\/wordpress\/index.php\/2018\/04\/25\/2018-4-24-how-to-build-a-powershell-gui-part-1\/","og_locale":"en_US","og_type":"article","og_title":"How to build a Powershell GUI - Part 1 - Nathan Kasco - Blog","og_description":"It seems like more and more I am seeing people wanting to implement GUIs into their tools, my hope is that this example can be used as a model for a way to properly create a WinForm GUI for your shiny new utility that you just got done creating.&nbsp;In this multi-part series I will be going through from start to finish a replacement tool for Windows Event Viewer\u2026","og_url":"https:\/\/blog.nkasco.com\/wordpress\/index.php\/2018\/04\/25\/2018-4-24-how-to-build-a-powershell-gui-part-1\/","og_site_name":"Nathan Kasco - Blog","article_published_time":"2018-04-25T02:10:21+00:00","og_image":[{"width":512,"height":512,"url":"https:\/\/blog.nkasco.com\/wordpress\/wp-content\/uploads\/2024\/03\/cropped-logo-1.png","type":"image\/png"}],"author":"Nate Kasco","twitter_card":"summary_large_image","twitter_creator":"@Bu5yGiraffe","twitter_site":"@Bu5yGiraffe","twitter_misc":{"Written by":"Nate Kasco","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.nkasco.com\/wordpress\/index.php\/2018\/04\/25\/2018-4-24-how-to-build-a-powershell-gui-part-1\/#article","isPartOf":{"@id":"https:\/\/blog.nkasco.com\/wordpress\/index.php\/2018\/04\/25\/2018-4-24-how-to-build-a-powershell-gui-part-1\/"},"author":{"name":"Nate Kasco","@id":"https:\/\/blog.nkasco.com\/wordpress\/#\/schema\/person\/1dfd694a2ed094a43a37dc6882c65eb3"},"headline":"How to build a Powershell GUI &#8211; Part 1","datePublished":"2018-04-25T02:10:21+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.nkasco.com\/wordpress\/index.php\/2018\/04\/25\/2018-4-24-how-to-build-a-powershell-gui-part-1\/"},"wordCount":365,"commentCount":0,"publisher":{"@id":"https:\/\/blog.nkasco.com\/wordpress\/#\/schema\/person\/1dfd694a2ed094a43a37dc6882c65eb3"},"keywords":["gui","utilities"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/blog.nkasco.com\/wordpress\/index.php\/2018\/04\/25\/2018-4-24-how-to-build-a-powershell-gui-part-1\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/blog.nkasco.com\/wordpress\/index.php\/2018\/04\/25\/2018-4-24-how-to-build-a-powershell-gui-part-1\/","url":"https:\/\/blog.nkasco.com\/wordpress\/index.php\/2018\/04\/25\/2018-4-24-how-to-build-a-powershell-gui-part-1\/","name":"How to build a Powershell GUI - Part 1 - Nathan Kasco - Blog","isPartOf":{"@id":"https:\/\/blog.nkasco.com\/wordpress\/#website"},"datePublished":"2018-04-25T02:10:21+00:00","breadcrumb":{"@id":"https:\/\/blog.nkasco.com\/wordpress\/index.php\/2018\/04\/25\/2018-4-24-how-to-build-a-powershell-gui-part-1\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.nkasco.com\/wordpress\/index.php\/2018\/04\/25\/2018-4-24-how-to-build-a-powershell-gui-part-1\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/blog.nkasco.com\/wordpress\/index.php\/2018\/04\/25\/2018-4-24-how-to-build-a-powershell-gui-part-1\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.nkasco.com\/wordpress\/"},{"@type":"ListItem","position":2,"name":"How to build a Powershell GUI &#8211; Part 1"}]},{"@type":"WebSite","@id":"https:\/\/blog.nkasco.com\/wordpress\/#website","url":"https:\/\/blog.nkasco.com\/wordpress\/","name":"Nathan Kasco - Blog","description":"","publisher":{"@id":"https:\/\/blog.nkasco.com\/wordpress\/#\/schema\/person\/1dfd694a2ed094a43a37dc6882c65eb3"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.nkasco.com\/wordpress\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/blog.nkasco.com\/wordpress\/#\/schema\/person\/1dfd694a2ed094a43a37dc6882c65eb3","name":"Nate Kasco","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.nkasco.com\/wordpress\/wp-content\/uploads\/2024\/03\/cropped-logo.png","url":"https:\/\/blog.nkasco.com\/wordpress\/wp-content\/uploads\/2024\/03\/cropped-logo.png","contentUrl":"https:\/\/blog.nkasco.com\/wordpress\/wp-content\/uploads\/2024\/03\/cropped-logo.png","width":200,"height":200,"caption":"Nate Kasco"},"logo":{"@id":"https:\/\/blog.nkasco.com\/wordpress\/wp-content\/uploads\/2024\/03\/cropped-logo.png"},"sameAs":["http:\/\/nkascocom.nk\/wordpress","https:\/\/x.com\/Bu5yGiraffe"],"url":"https:\/\/blog.nkasco.com\/wordpress\/index.php\/author\/nate\/"}]}},"_links":{"self":[{"href":"https:\/\/blog.nkasco.com\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/10","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.nkasco.com\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.nkasco.com\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.nkasco.com\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.nkasco.com\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=10"}],"version-history":[{"count":0,"href":"https:\/\/blog.nkasco.com\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/10\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.nkasco.com\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=10"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.nkasco.com\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=10"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.nkasco.com\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=10"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}