{"id":1855,"date":"2011-11-21T12:26:51","date_gmt":"2011-11-21T17:26:51","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=1855"},"modified":"2011-11-21T14:32:37","modified_gmt":"2011-11-21T19:32:37","slug":"test-subnet-winform","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1855\/test-subnet-winform\/","title":{"rendered":"Test-Subnet WinForm"},"content":{"rendered":"<p>Recently, I posted an entry on how to <a href=\"http:\/\/jdhitsolutions.com\/blog\/2011\/11\/ping-ip-range\/\" target=\"_blank\">ping an IP subnet with PowerShell<\/a>. Using objects in the PowerShell pipeline is a good thing. But sometimes we want a GUI and I figured the ping subnet script would make a good WinForm script.<!--more--><\/p>\n<p>When creating graphical PowerShell scripts, I always recommend starting with a PowerShell script or function that you know works in the console. Don't try to create a WinForm (or ShowUI) script at the same time you are trying to develop the core functionality. Start with something that already works and transform that into a GUI. For my script I turned to <a href=\"http:\/\/sapien.com\/software\/primalforms\" target=\"_blank\">PrimalForms 2011<\/a> from SAPIEN Technologies. I quickly put together a form using form controls for all of the script's original parameters. I then took my existing code and started with that as the body for the Click event on my Ping button.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n$buttonPing_Click={<br \/>\n\t\t$formSubnetPing.Cursor=\"WaitCursor\"<\/p>\n<p>\t\t$array = New-Object System.Collections.ArrayList<br \/>\n\t\t$bindings=New-Object System.Windows.Forms.BindingSource<br \/>\n\t\t$datagridview1.DataSource = $bindings<br \/>\n\t\t$datagridview1.Refresh()<br \/>\n\t\t$formSubnetPing.Refresh()<\/p>\n<p>\t\t[string]$Subnet=$textboxSubNet.Text<br \/>\n\t\t[int[]]$Range=($numericStart.Value)..($numericEnd.Value)<br \/>\n\t\t[int]$Count=$textboxCount.Text<br \/>\n\t\t[int]$Delay=$textboxDelay.Text<br \/>\n\t\t[int]$Buffer=$textboxBuffer.Text<br \/>\n\t\t[int]$TTL=$textboxTTL.Text<\/p>\n<p>\t\t$range | foreach {<br \/>\n\t    $target=\"$subnet.$_\"<br \/>\n\t\t$statusbar1.Text=\"Pinging $target\"<\/p>\n<p>\t    $ping=Test-Connection -ComputerName $target -count $count -Delay $delay -BufferSize $Buffer -TimeToLive $ttl -Quiet<\/p>\n<p>\t    $obj=New-Object -TypeName PSObject -Property @{<br \/>\n\t        IPAddress=$Target<br \/>\n\t        Pinged=$ping.ToString()<br \/>\n\t        TTL=$TTL<br \/>\n\t        BufferSize=$buffer<br \/>\n\t        Delay=$Delay<br \/>\n\t        TestDate=Get-Date<br \/>\n\t    }<br \/>\n\t\t\t#add hostname if checked<br \/>\n\t\t\tif ($checkboxResolveNames.Checked -and ($obj.Pinged -eq 'True')) {<br \/>\n\t\t\t\t#turn off error pipeline<br \/>\n\t\t\t\t$ErrorActionPreference=\"SilentlyContinue\"<br \/>\n\t\t\t\t$dns=[system.Net.Dns]::GetHostByAddress($obj.IPAddress)<br \/>\n\t\t\t\tif ($dns.HostName) {<br \/>\n\t\t\t\t  $hostname=$dns.HostName<br \/>\n\t\t\t\t}<\/p>\n<p>\t\t\t\t$ErrorActionPreference=\"Continue\"<br \/>\n\t\t\t}<br \/>\n\t\t\telse {<br \/>\n\t\t\t\t$hostname=$obj.IPAddress<br \/>\n\t\t\t}<\/p>\n<p>\t\t\t$obj | Add-Member -MemberType \"Noteproperty\" -Name \"HostName\" -Value $Hostname -PassThru<\/p>\n<p>            #uncomment for debugging<br \/>\n\t\t\t#Write-Host ($obj | Out-String)<\/p>\n<p>\t\t\t#write result to grid<br \/>\n\t\t\tif ($checkboxOnlyShowPinged.Checked -and ($obj.Pinged -eq 'True')) {<br \/>\n\t\t\t\t$array.Add($obj)<br \/>\n\t\t\t}<br \/>\n\t\t\telseif (!($checkboxOnlyShowPinged.Checked)) {<br \/>\n\t\t\t\t$array.Add($obj)<br \/>\n\t\t\t}<br \/>\n\t\t\t#add to the datasource if there is something in $array<br \/>\n\t\t    if ($array.Count -gt 0) {<br \/>\n    \t\t\t$bindings.DataSource=$array<br \/>\n    \t\t    $bindings.ResetBindings($false)<br \/>\n\t\t\t}<br \/>\n\t\t\t#wait for the form to finish processing tasks. This is critical<br \/>\n\t\t\t#when not running in STA mode.<br \/>\n\t\t\t[system.Windows.Forms.Application]::DoEvents()<\/p>\n<p>\t\t} #foreach<\/p>\n<p>\t\t$statusbar1.Text=\"Ready\"<br \/>\n\t\t$formSubnetPing.Cursor=\"Default\"<\/p>\n<p>\t} #click<br \/>\n[\/cc]<\/p>\n<p>I'm not going to go through every line but I do want to point out a few things. I wanted each ping result to be written to a datagridview control as it was created. In order to get that to work, instead of setting the control's DataSource property to the array, I created a BindingSource object and set that for the DataSource property.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n$bindings=New-Object System.Windows.Forms.BindingSource<br \/>\n$datagridview1.DataSource = $bindings<br \/>\n[\/cc]<\/p>\n<p>Then, as each object was added to the array, I set the array as the DataSource for the binding which in turn passes the values on automatically to the DataGridView control. Remember, I'm not a developer so there may be more technically accurate descriptions about what is happening, but this works which is all I care about.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nif ($array.Count -gt 0) {<br \/>\n    $bindings.DataSource=$array<br \/>\n    $bindings.ResetBindings($false)<br \/>\n}<br \/>\n[\/cc]<\/p>\n<p>The other important element I added is this:<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n[system.Windows.Forms.Application]::DoEvents()<br \/>\n[\/cc]<\/p>\n<p>When you run a WinForm script like this, everything runs in a single thread. This includes my PowerShell code as well as all of the graphic elements. What happens is that things can get backed up and you end up with the form not responding. If you run the script in a PowerShell session in STA mode, such as the ISE, you don't run into this problem. My DoEvents() method essentially tells the form to take care of any outstanding work and then move on. With this in place the form runs and I don't get the dreaded Not Responding problem.<\/p>\n<p>I took the liberty of adding a few other items such as resolving names using the DNS .NET class.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nif ($checkboxResolveNames.Checked -and ($obj.Pinged -eq 'True')) {<br \/>\n  #turn off error pipeline<br \/>\n  $ErrorActionPreference=\"SilentlyContinue\"<br \/>\n  $dns=[system.Net.Dns]::GetHostByAddress($obj.IPAddress)<br \/>\n  if ($dns.HostName) {<br \/>\n    $hostname=$dns.HostName<br \/>\n  }<\/p>\n<p>$ErrorActionPreference=\"Continue\"<br \/>\n}<br \/>\n[\/cc]<\/p>\n<p>I temporarily turn off the Error pipeline because the GetHostByAddress() method will throw an exception if it can't be found. In that case I'm going to set the hostname property to the IP address. This assumes you have a valid reverse lookup zone.<\/p>\n<p>Here's what the finished product looks like:<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/11\/subnetpingform.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/11\/subnetpingform-300x178.png\" alt=\"\" title=\"subnetpingform\" width=\"300\" height=\"178\" class=\"aligncenter size-medium wp-image-1856\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/11\/subnetpingform-300x178.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/11\/subnetpingform.png 674w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>The script is far from perfect or finished. For example, there is no error checking for validation for items like the subnet or start and stop values. You might like the option to export or print results. I'm including my PrimalForms source PFF file so that if you have it, you can edit the source and generate a new script or package. <\/p>\n<p>Download <a href='http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/11\/TestSubnetForm.zip'>TestSubnetForm.zip<\/a> and let me know what you think.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently, I posted an entry on how to ping an IP subnet with PowerShell. Using objects in the PowerShell pipeline is a good thing. But sometimes we want a GUI and I figured the ping subnet script would make a good WinForm script.<\/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,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,64,8],"tags":[332,534,555,174,95],"class_list":["post-1855","post","type-post","status-publish","format-standard","hentry","category-powershell","category-primalforms","category-scripting","tag-ping","tag-powershell","tag-primalforms","tag-test-connection","tag-winform"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Test-Subnet WinForm &#8226; The Lonely Administrator<\/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:\/\/jdhitsolutions.com\/blog\/powershell\/1855\/test-subnet-winform\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Test-Subnet WinForm &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Recently, I posted an entry on how to ping an IP subnet with PowerShell. Using objects in the PowerShell pipeline is a good thing. But sometimes we want a GUI and I figured the ping subnet script would make a good WinForm script.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/1855\/test-subnet-winform\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2011-11-21T17:26:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2011-11-21T19:32:37+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/11\/subnetpingform-300x178.png\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1855\\\/test-subnet-winform\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1855\\\/test-subnet-winform\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Test-Subnet WinForm\",\"datePublished\":\"2011-11-21T17:26:51+00:00\",\"dateModified\":\"2011-11-21T19:32:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1855\\\/test-subnet-winform\\\/\"},\"wordCount\":812,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1855\\\/test-subnet-winform\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/11\\\/subnetpingform-300x178.png\",\"keywords\":[\"Ping\",\"PowerShell\",\"PrimalForms\",\"Test-Connection\",\"WinForm\"],\"articleSection\":[\"PowerShell\",\"PrimalForms\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1855\\\/test-subnet-winform\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1855\\\/test-subnet-winform\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1855\\\/test-subnet-winform\\\/\",\"name\":\"Test-Subnet WinForm &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1855\\\/test-subnet-winform\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1855\\\/test-subnet-winform\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/11\\\/subnetpingform-300x178.png\",\"datePublished\":\"2011-11-21T17:26:51+00:00\",\"dateModified\":\"2011-11-21T19:32:37+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1855\\\/test-subnet-winform\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1855\\\/test-subnet-winform\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1855\\\/test-subnet-winform\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/11\\\/subnetpingform.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/11\\\/subnetpingform.png\",\"width\":\"674\",\"height\":\"400\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1855\\\/test-subnet-winform\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Test-Subnet WinForm\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Test-Subnet WinForm &#8226; The Lonely Administrator","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:\/\/jdhitsolutions.com\/blog\/powershell\/1855\/test-subnet-winform\/","og_locale":"en_US","og_type":"article","og_title":"Test-Subnet WinForm &#8226; The Lonely Administrator","og_description":"Recently, I posted an entry on how to ping an IP subnet with PowerShell. Using objects in the PowerShell pipeline is a good thing. But sometimes we want a GUI and I figured the ping subnet script would make a good WinForm script.","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1855\/test-subnet-winform\/","og_site_name":"The Lonely Administrator","article_published_time":"2011-11-21T17:26:51+00:00","article_modified_time":"2011-11-21T19:32:37+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/11\/subnetpingform-300x178.png","type":"","width":"","height":""}],"author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1855\/test-subnet-winform\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1855\/test-subnet-winform\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Test-Subnet WinForm","datePublished":"2011-11-21T17:26:51+00:00","dateModified":"2011-11-21T19:32:37+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1855\/test-subnet-winform\/"},"wordCount":812,"commentCount":2,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1855\/test-subnet-winform\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/11\/subnetpingform-300x178.png","keywords":["Ping","PowerShell","PrimalForms","Test-Connection","WinForm"],"articleSection":["PowerShell","PrimalForms","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/1855\/test-subnet-winform\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1855\/test-subnet-winform\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1855\/test-subnet-winform\/","name":"Test-Subnet WinForm &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1855\/test-subnet-winform\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1855\/test-subnet-winform\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/11\/subnetpingform-300x178.png","datePublished":"2011-11-21T17:26:51+00:00","dateModified":"2011-11-21T19:32:37+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1855\/test-subnet-winform\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/1855\/test-subnet-winform\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1855\/test-subnet-winform\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/11\/subnetpingform.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/11\/subnetpingform.png","width":"674","height":"400"},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1855\/test-subnet-winform\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Test-Subnet WinForm"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":389,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/389\/add-tooltip-help-to-your-primalforms-script\/","url_meta":{"origin":1855,"position":0},"title":"Add Tooltip help to your PrimalForms script","author":"Jeffery Hicks","date":"September 24, 2009","format":false,"excerpt":"I've been doing some work lately in the newest version of SAPIEN's PrimalForms 2009. I like to make my scripts as user friendly as possible without forcing someone to read lengthy and boring documentation. One technique that I've started using is to use a ToolTip control and offer a short\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"primalforms.png","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2009\/09\/primalforms.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":153,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/153\/primalforms-now-available\/","url_meta":{"origin":1855,"position":1},"title":"PrimalForms now Available","author":"Jeffery Hicks","date":"November 3, 2008","format":false,"excerpt":"Even though PowerShell is by design a console based management tool, there are instances where you would like to use a GUI. PowerShell can use the Windows forms classes from the .NET Framework. However in the past creating anything other than the simplest of forms was very tedious and time\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":530,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/530\/putting-the-squeeze-on-files-with-powershell\/","url_meta":{"origin":1855,"position":2},"title":"Putting the Squeeze on Files with PowerShell","author":"Jeffery Hicks","date":"December 9, 2009","format":false,"excerpt":"My December Mr. Roboto column is now online This month\u2019s tool is a PowerShell WinForm script that uses WMI to compress files. I used PrimalForms 2009 to build the graphical interface. The interface is essentially a wizard that lets you build a WMI query to find files and compress them.\u00a0\u2026","rel":"","context":"In &quot;Mr. Roboto&quot;","block_context":{"text":"Mr. Roboto","link":"https:\/\/jdhitsolutions.com\/blog\/category\/mr-roboto\/"},"img":{"alt_text":"captured_Image.png","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2009\/12\/captured_Image.png_thumb.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":383,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/383\/primalforms-2009-script-editor\/","url_meta":{"origin":1855,"position":3},"title":"PrimalForms 2009 Script Editor","author":"Jeffery Hicks","date":"September 22, 2009","format":false,"excerpt":"SAPIEN\u2019s Primal Forms 2009 now has an integrated script editor that you can use as a standalone editor for PowerShell scripts. The app has integrated help, popup command help, a PowerShell browser, a .NET object browser. As you can see in the screen shot I\u2019ve started a very basic PowerShell\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"primalforms2009-script","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2009\/09\/primalforms2009script_thumb.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":165,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/165\/primalforms-2009-now-available\/","url_meta":{"origin":1855,"position":4},"title":"PrimalForms 2009 Now Available","author":"Jeffery Hicks","date":"August 4, 2009","format":false,"excerpt":"SAPIEN Technologies finally released PrimalForms 2009. If you have any sort of requirement to create a graphical interface to your PowerShell script, this is the tool to get.\u00a0 SAPIEN will continue to offer the free community version of Primal Forms from their community tools page. PrimalForms 2009 includes these features:\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1738,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1738\/ping-ip-range\/","url_meta":{"origin":1855,"position":5},"title":"Ping IP Range","author":"Jeffery Hicks","date":"November 7, 2011","format":false,"excerpt":"Last week I came across a post on using PowerShell, or more specifically a .NET Framework class, to ping a range of computers in an IP subnet. The original post by Thomas Maurer is here. I added a comment. And after looking at this again I decided to take the\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1855","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=1855"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1855\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=1855"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=1855"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=1855"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}